Advisory Database
  • Advisories
  • Dependency Scanning
  1. cargo
  2. ›
  3. gix-attributes
  4. ›
  5. GHSA-cx7h-h87r-jpgr

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

July 25, 2024 (updated January 21, 2025)

gix-attributes (in state::ValueRef) 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:

// 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.

References

  • github.com/Byron/gitoxide
  • github.com/Byron/gitoxide/issues/1460
  • github.com/GitoxideLabs/gitoxide/issues/1460
  • github.com/advisories/GHSA-cx7h-h87r-jpgr
  • github.com/rustsec/advisory-db/commit/884aaa1646132bc3a27ba058197d6ef039bec294
  • rustsec.org/advisories/RUSTSEC-2024-0359.html

Code Behaviors & Features

Detect and mitigate GHSA-cx7h-h87r-jpgr with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →

Affected versions

All versions before 0.22.3

Fixed versions

  • 0.22.3

Solution

Upgrade to version 0.22.3 or above.

Weakness

  • CWE-172: Encoding Error

Source file

cargo/gix-attributes/GHSA-cx7h-h87r-jpgr.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sun, 08 Nov 2026 00:17:25 +0000.