GitPython: Incomplete unsafe_git_archive_options denylist omits --add-file / --add-virtual-file, enabling arbitrary file read via Repo.archive()
Affects GitPythonSource GCVE Database
CVSS 6.5 Medium : upgrade to 3.1.57 when convenient.
Data as of 3 Aug 2026, 21:24 UTC
- Patch
- Available – fixed in 3.1.57
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:NWhat to do
Upgrade GitPython to 3.1.57.
Affected software
| Product | Affected | Fixed in |
|---|---|---|
| PyPIGitPython | Affected
| Fixed in
|
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
AI-suggested
A patch is available for this vulnerability. The vendor or maintainers have extended the denylist to include --add-file and --add-virtual-file options or recommend implementing a strict allowlist of safe options for Repo.archive(). Users should upgrade GitPython to version 3.1.57 or later where this issue is fixed. If upgrading is not immediately possible, avoid passing user-controlled options to Repo.archive() or implement custom validation to block these unsafe options.
Description
GitPython's Repo.archive() method uses a denylist to block unsafe git archive options, but this denylist is incomplete. Specifically, the options --add-file and --add-virtual-file, which allow reading arbitrary files from the filesystem and injecting arbitrary content into archives, are not blocked. This enables an attacker who can control the options passed to Repo.archive() to read arbitrary files with the privileges of the running process. The vulnerability does not allow code execution but can lead to sensitive file disclosure. A patch is available that extends the denylist to cover these options or implements a safer allowlist approach.
References
- github.com/gitpython-developers/GitPython/security/advisories/GHSA-539m-9xh6-q6rr (opens in a new tab)
- github.com/gitpython-developers/GitPython/pull/2193 (opens in a new tab)
- github.com/gitpython-developers/GitPython/commit/7a4f5dcb7bf3cbcbf6e438017efcdfe0bc0d36ca (opens in a new tab)
- github.com/gitpython-developers/GitPython (opens in a new tab)
- github.com/gitpython-developers/GitPython/releases/tag/3.1.57 (opens in a new tab)