fix: block unsafe long-option prefixes (GHSA-2f96-g7mh-g2hx) by Byron · Pull Request #2161 · gitpython-developers/GitPython
Repository navigation
fix: block unsafe long-option prefixes (GHSA-2f96-g7mh-g2hx) - #2161
Closed
Byron wants to merge 1 commit into main from fix-aut-joined-short-bypass-2
Closed
fix: block unsafe long-option prefixes (GHSA-2f96-g7mh-g2hx) #2161 Byron wants to merge 1 commit into main from fix-aut-joined-short-bypass-2
Conversation
Byron commented Jun 17, 2026 · edited Loading
Copy link Copy Markdown
Member
Tasks
- basic review
Advisory
- Advisory URL: GHSA-2f96-g7mh-g2hx
- GHSA: GHSA-2f96-g7mh-g2hx
- Severity: high (estimated CVSS 8.8, CVE-2026-42215 class)
- Affected package/version range: PyPI: GitPython
<= 3.1.50(to latest main at the time of report) - Patched versions: none
Advisory summary
Git accepts long-option abbreviations, so exact-match unsafe-option checks could be bypassed (upload_p matching upload-pack).
This change keeps unsafe-option checks centralized in Git.check_unsafe_options and rejects canonical option prefixes in addition to exact matches.
Changes
git/cmd.py: prefix-aware unsafe-option matching against canonicalized option names.test/test_git.py: regression cases for abbreviated dangerous option names.test/test_remote.py: fetch/pull/push regression cases for abbreviated options.test/test_clone.py: clone and clone_from regression cases for abbreviated upload options.
Validation
stg show c705fe7e...(contains the comment-only fix-up on top of the advisory patch stack)git rev-parse c705fe7ecodex review --commit c705fe7e(no blocking findings; comment-only change)- Focused pytest execution could not be run here because
pytestis not installed in this environment.
Created by Codex on behalf of Byron. Byron will review before this is ready to merge.
Copilot PR reviewer CopilotAI
review requested due to automatic review settings June 17, 2026 04:28 Copilot started reviewing on behalf of Byron June 17, 2026 04:33
View session
Copilot PR reviewer Copilot
AI
reviewed Jun 17, 2026
View reviewed changes
Copilot
AI
left a comment
Copy link Copy Markdown
Contributor
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 addresses GHSA-2f96-g7mh-g2hx by hardening GitPython's unsafe-option filtering to also reject abbreviated long options (leveraging Git's acceptance of long-option prefixes), and adds regression tests to prevent bypasses like upload_p → upload-pack.
Changes:
- Update
Git.check_unsafe_optionsto treat prefixes of unsafe long options as unsafe. - Add regression tests covering abbreviated unsafe options for clone/fetch/pull/push APIs.
- Expand unit coverage for canonicalization and prefix behavior in unsafe-option checks.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
git/cmd.py |
Implements prefix-aware unsafe-option matching (needs adjustment to avoid blocking safe short options). |
test/test_git.py |
Adds unit cases asserting abbreviated long options are detected as unsafe. |
test/test_remote.py |
Adds fetch/pull/push regression cases for abbreviated unsafe options. |
test/test_clone.py |
Adds clone/clone_from regression cases for abbreviated upload-pack options. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started .
Byron force-pushed the fix-aut-joined-short-bypass-2 branch fromc705fe7 to
ae091b7
Compare
June 17, 2026 05:45 Copilot PR reviewer Copilot
AI
review requested due to automatic review settings June 17, 2026 08:00 Byron force-pushed the fix-aut-joined-short-bypass-2 branch from
ae091b7 to
6762a2c
Compare
June 17, 2026 08:00 Copilot started reviewing on behalf of Byron June 17, 2026 08:03
View session
Copilot PR reviewer Copilot
AI
reviewed Jun 17, 2026
View reviewed changes
Copilot
AI
left a comment
Copy link Copy Markdown
Contributor
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 5 out of 5 changed files in this pull request and generated 4 comments.
Byron mentioned this pull request Jun 17, 2026 fix: block joined short unsafe clone options #2162 Closed 1 of 2 tasks
fix: block unsafe long-option prefixes (GHSA-2f96-g7mh-g2hx) [ruff-fo...
0d88094
...rmat]Byron force-pushed the fix-aut-joined-short-bypass-2 branch from
6762a2c to
0d88094
Compare
June 17, 2026 09:17
Byron commented Jul 12, 2026
Copy link Copy Markdown
Member
Author
|
Closing as superseded by #2168 |
Bot
mentioned this pull request Jul 29, 2026 Update fastapi to 0.141.0 trebizondoculpepper/dockerized_python_playground#614 Closed it-integrations mentioned this pull request Aug 6, 2026 🟠 [High] GitPython: Command Injection via Git Long-Option Prefix Abbreviation Bypass of CVE-2026-42215 Blocklist Latch/connectedhomeip#43 Closed Byron deleted the fix-aut-joined-short-bypass-2 branch October 5, 2026 03:25 Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment