The kstring integration in gix-attributes is unsound
Key facts
- Attack vector
- —
- Privileges required
- —
- User interaction
- —
- Attack complexity
- —
- Impact type
- —
- Confidentiality · integrity · availability
- —
- Fix status
- Fixed
No CVSS vector from any source. Fix status from GitHub.
Summary
`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`.
Why it matters now
SSVC decision points
Not available: CISA has not published SSVC decision points for this record.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| — | gix-attributes (crates.io) | before 0.22.3 | 0.22.3 | Patch available | GHSA-cx7h-h87r-jpgr |
- gix-attributes (crates.io) Vendor— Affected before 0.22.3 Fixed in 0.22.3 Patch available GHSA-cx7h-h87r-jpgr
Remediation
- Fix · GHSA-cx7h-h87r-jpgr gix-attributes (crates.io) Fixed in 0.22.3 Advisory →
Timeline
- 2026-10-03 Threatist record created from GHSA-cx7h-h87r-jpgr
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences