# GHSA-cx7h-h87r-jpgr: The kstring integration in gix-attributes is unsound

- Severity: Low (rating, scored by GitHub)
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Published: 2024-07-24T12:00:00.000Z
- Modified: 2026-09-10T03:50:16.580Z
- Also known as: RUSTSEC-2024-0359
- Weaknesses: CWE-172

## Description

`gix-attributes` (in [`state::ValueRef`](https://github.com/Byron/gitoxide/blob/gix-attributes-v0.22.2/gix-attributes/src/state.rs#L19-L27)) unsafely creates a `&str` from a `&[u8]` containing non-UTF8 data, with the justification that so long as nothing reads the `&str` and relies on it being UTF-8 in the `&str`, there is no UB:

```rust
// SAFETY: our API makes accessing that value as `str` impossible, so illformed UTF8 is never exposed as such.
```

The problem is that the non-UTF8 `str` **is** exposed to outside code: first to the `kstring` crate itself, which requires UTF-8 in its documentation and may have UB as a consequence of this, but also to `serde`, where it propagates to e.g. `serde_json`, `serde_yaml`, etc., where the same problems occur.

This is not sound, and it could cause further UB down the line in these places that can view the `&str`.

(As written by GitHub Advisory Database.)

## Affected

- gix-attributes (crates.io): before 0.22.3; from 0.0.0-0 before 0.22.3

## References

- <https://github.com/Byron/gitoxide/issues/1460> (web)
- <https://github.com/GitoxideLabs/gitoxide/issues/1460> (report, web)
- <https://github.com/rustsec/advisory-db/commit/884aaa1646132bc3a27ba058197d6ef039bec294> (web)
- <https://github.com/Byron/gitoxide> (package)
- <https://rustsec.org/advisories/RUSTSEC-2024-0359.html> (advisory, web)
- <https://crates.io/crates/gix-attributes> (package)

## Sources

- GitHub Advisory Database: [GHSA-cx7h-h87r-jpgr](https://github.com/advisories/GHSA-cx7h-h87r-jpgr), CC-BY-4.0, modified 2026-09-10
- RustSec Advisory Database: [RUSTSEC-2024-0359](https://rustsec.org/advisories/RUSTSEC-2024-0359.html), CC0-1.0, modified 2025-01-19

---

Page: https://cve.day/GHSA-cx7h-h87r-jpgr · Whole record: https://cve.day/GHSA-cx7h-h87r-jpgr.json · Rebuilt by cve.day 2026-11-25T22:56:43.206Z
