GitPython: --no-index bypasses diff unsafe-option protections and enables a blind local-file content oracle
### Summary GitPython 3.1.59 blocks a previously available local-file read path through unsafe git diff options such as -O/--orderfile. However, the high-level diff API still permits --no-index with the default allow_unsafe_options=False. --no-index changes the semantics of the paths arguments: instead of repository-relative pathspecs, Git interprets them as arbitrary filesystem paths. When combined with the still-allowed -I/--ignore-matching-lines option, this creates a content-dependent Boolean oracle over a caller-selected local file. This was reproduced against the published GitPython 3.1.59 wheel. The original unsafe-option path is blocked in 3.1.59, while this alternate path remains reachable without setting allow_unsafe_options=True. ### Details Confirmed API surface: repo.index.diff( None, no_index=True, I=pattern, paths=[baseline_path, target_path], create_patch=True, ) The relevant behavior is: 1. --no-index makes the two values supplied via paths filesystem operands rather than repository pathspecs. 2. -I/--ignore-matching-lines makes Git's result depend on whether the supplied regular expression matches the relevant file content. 3. GitPython exposes the resulting bit through distinguishable behavior: - matching condition: normal return with an empty DiffIndex - non-matching condition: GitCommandError with exit status 1 An application that forwards attacker-influenced diff options and paths and exposes the success/error distinction can therefore be queried repeate
PYSEC-2026-3983
Revision 1 · Withdrawn
PYSEC-2026-3983
GitPython 3.1.59 fails to restrict the --no-index option in the high-level diff API, allowing attackers to read arbitrary filesystem paths as repository operands. Attackers can combine --no-index with -I/--ignore-matching-lines to create a content-dependent Boolean oracle, repeatedly querying local files to recover single-line secrets through distinguishable success or error responses.
Imported from structured advisory data. Source references identify upstream records or fields; verify affected versions and your deployed configuration.
Security context
Source reference: osv:PYSEC-2026-3983
gitpython
Source reference: /affected/0/package/name
- Affected versions
- 3.1.59
Source reference:
/affected/0/versions - Fixed versions
- 3.1.60
Source reference:
/affected/0/ranges - Prerequisites
- Not stated in this record
Structured affected-version data
Original package identities and version rules from this source.
[
{
"ranges": [
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "3.1.59"
},
{
"fixed": "3.1.60"
}
]
}
],
"package": {
"name": "gitpython",
"purl": "pkg:pypi/gitpython",
"ecosystem": "PyPI"
},
"versions": [
"3.1.59"
],
"database_specific": {
"source": "https://github.com/pypa/advisory-database/blob/main/vulns/gitpython/PYSEC-2026-3983.yaml"
},
"ecosystem_specific": {}
}
]- Related CVEs
- CVE-2026-87818
Source reference:
/aliases
Publisher severity
No explicit severity was provided.
- Event
- #62466 · Revision 1
- Added to Heist Feed
- Publisher date
GHSA-whh4-5q6c-9v3x
Primary source · Revision 1
Imported from structured advisory data. Source references identify upstream records or fields; verify affected versions and your deployed configuration.
Security context
Source reference: osv:GHSA-whh4-5q6c-9v3x
gitpython
Source reference: /affected/0/package/name
- Affected versions
- 3.1.59
Source reference:
/affected/0/versions - Fixed versions
- 3.1.60
Source reference:
/affected/0/ranges - Prerequisites
- Not stated in this record
Structured affected-version data
Original package identities and version rules from this source.
[
{
"ranges": [
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "3.1.59"
},
{
"fixed": "3.1.60"
}
]
}
],
"package": {
"name": "gitpython",
"purl": "pkg:pypi/gitpython",
"ecosystem": "PyPI"
},
"versions": [
"3.1.59"
],
"database_specific": {
"source": "https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/09/GHSA-whh4-5q6c-9v3x/GHSA-whh4-5q6c-9v3x.json"
}
}
]- Related CVEs
- CVE-2026-87818
Source reference:
/aliases
Publisher severity
No explicit severity was provided.
- Event
- #62467 · Revision 1
- Added to Heist Feed
- Publisher date