GeezerVison is showing github.com — Block unsafe Git file and URL options by Byron · Pull Request #2193 · gitpython-developers/GitPython
Conversation
Byron
commented
Jul 26, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Tasks
This section is for Byron only. Models continuing this PR must not add, remove, check, uncheck, rename, or reorder checkboxes here.
Everything below this line was generated by Codex GPT-5.
Created by Codex on behalf of Byron. Byron will review before this is ready to merge.
Summary
Block unsafe filesystem-path and URL options in GitPython APIs by default while retaining the explicit allow_unsafe_options=True opt-out.
- Guard filesystem-path options forwarded by
IndexFile.checkout() and TagReference.create().
- Extend the existing archive denylist for caller-controlled additions.
- Extend the existing clone denylist for caller-controlled bundle URLs.
Advisory summaries
- Advisory: GHSA-3f7w-8rr8-f37f
- Severity: High
- Package/range: GitPython (pip), <= 3.1.55
- Patched versions: not yet assigned
- CVE: not yet assigned
- Advisory: GHSA-539m-9xh6-q6rr
- Severity: Medium
- Package/range: GitPython (pip), <= 3.1.55
- Patched versions: not yet assigned
- CVE: not yet assigned
Both advisories remain private, so exploit details are intentionally omitted here.
Validation
- Focused security tests for both commits pass
- Touched-file Ruff check and format check pass
git diff --check passes
- Broader affected-module runs pass the changed paths; remaining failures are unrelated legacy fixture/default-branch assumptions
Git behavior was checked against Git a23bace963d508bd96983cc637131392d3face18 and the relevant git-checkout-index, git-tag, git-archive, and git-clone documentation.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Byron
changed the title
Block unsafe checkout-index and tag file options
Block unsafe Git file and URL options
Jul 26, 2026
GHSA-3f7w-8rr8-f37f reports that caller-controlled options forwarded by
IndexFile.checkout() and TagReference.create() can make Git write to or read
from arbitrary filesystem paths.
Add regression coverage proving the unsafe options are rejected by default while
preserving the explicit allow_unsafe_options escape hatch. Reuse GitPython's
existing option candidate normalization and unsafe-option guard at both public
API boundaries.
Git baseline: a23bace963d508bd96983cc637131392d3face18.
Documentation/git-checkout-index.adoc defines --prefix as prepending an output
path, and Documentation/git-tag.adoc defines -F/--file as reading a tag message
from a file.
Co-authored-by: Sebastian Thiel <[email protected]>
GHSA-539m-9xh6-q6rr reports incomplete unsafe option lists for archive inputs
and clone bundle URLs. Caller-controlled archive additions can expose or inject
filesystem content, while clone --bundle-uri can dereference an additional
caller-controlled URL.
Extend the existing archive denylist with --add-file and --add-virtual-file,
and the clone denylist with --bundle-uri. Regression coverage exercises archive
kwargs plus both clone multi-option and keyword paths.
Git baseline: a23bace963d508bd96983cc637131392d3face18.
Documentation/git-archive.adoc defines --add-file/--add-virtual-file, and
Documentation/git-clone.adoc defines --bundle-uri as fetching from the supplied
URI.
Co-authored-by: Sebastian Thiel <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR strengthens GitPython’s security posture by blocking additional unsafe filesystem-path and URL options across higher-level APIs by default, while preserving an explicit allow_unsafe_options=True opt-out for callers that need these capabilities.
Changes:
- Add unsafe-option gating to
IndexFile.checkout() (--prefix) and TagReference.create() (-F/--file), controlled by allow_unsafe_options.
- Expand the existing unsafe-option denylists for
git archive (--add-file, --add-virtual-file) and git clone (--bundle-uri).
- Add/extend focused tests asserting unsafe options raise
UnsafeOptionError.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File |
Description |
git/repo/base.py |
Extends clone/archive unsafe option denylists to cover bundle URI and archive file-injection options. |
git/refs/tag.py |
Blocks tag message-from-file options by default in TagReference.create(), with an explicit opt-out. |
git/index/base.py |
Blocks checkout-index --prefix usage by default in IndexFile.checkout(), with an explicit opt-out. |
test/test_clone.py |
Adds clone tests covering --bundle-uri and bundle_uri being rejected by default. |
test/test_repo.py |
Adds archive tests covering add_file and add_virtual_file being rejected by default. |
test/test_refs.py |
Adds tests asserting TagReference.create() rejects -F/--file unless explicitly allowed. |
test/test_index.py |
Adds a test asserting IndexFile.checkout() rejects --prefix unless explicitly allowed. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|