GHSA-3f7w-8rr8-f37f: GitPython: Unguarded git option forwarding in IndexFile.checkout() and TagReference.create() enables arbitrary file overwrite and arbitrary file read
GitPython blocks dangerous git options through Git.check_unsafe_options(), gated per method by an allow_unsafe_options parameter. That guard is applied per call site, so any API that forwards **kwargs into a git command without calling it passes caller-controlled options straight to git.
A mechanical sweep of every method that forwards **kwargs into a .git.<command>(...) call found 14 sites with no guard. Two reach a git option that takes a filesystem path:
| # | Call site | git option | Impact |
|---|---|---|---|
| 1 | IndexFile.checkout() → git checkout-index | --prefix=<path> | arbitrary file overwrite with repository-controlled content |
| 2 | TagReference.create() → git tag | -F <file> / --file=<file> | arbitrary file read, returned in-band |
This is the same defect class already fixed in Commit.count() (GHSA-p538-c434-8v24), Repo.archive() and Git.ls_remote() (GHSA-956x-8gvw-wg5v). Both instances below are still present at HEAD.
References
- github.com/advisories/GHSA-3f7w-8rr8-f37f
- github.com/gitpython-developers/GitPython/commit/3af0c2516c5e18c829da30338614688f6b69b49c
- github.com/gitpython-developers/GitPython/pull/2193
- github.com/gitpython-developers/GitPython/releases/tag/3.1.57
- github.com/gitpython-developers/GitPython/security/advisories/GHSA-3f7w-8rr8-f37f
Code Behaviors & Features
Detect and mitigate GHSA-3f7w-8rr8-f37f 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 →