Skip to content

fix: block unsafe long-option prefixes (GHSA-2f96-g7mh-g2hx)#2161

Open
Byron wants to merge 1 commit into
mainfrom
fix-aut-joined-short-bypass-2
Open

fix: block unsafe long-option prefixes (GHSA-2f96-g7mh-g2hx)#2161
Byron wants to merge 1 commit into
mainfrom
fix-aut-joined-short-bypass-2

Conversation

@Byron

@Byron Byron commented Jun 17, 2026

Copy link
Copy Markdown
Member

Tasks

  • basic review

Advisory

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 c705fe7e
  • codex review --commit c705fe7e (no blocking findings; comment-only change)
  • Focused pytest execution could not be run here because pytest is not installed in this environment.

Created by Codex on behalf of Byron. Byron will review before this is ready to merge.

Copilot AI review requested due to automatic review settings June 17, 2026 04:28

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_pupload-pack.

Changes:

  • Update Git.check_unsafe_options to 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.

Comment thread git/cmd.py Outdated
@Byron Byron force-pushed the fix-aut-joined-short-bypass-2 branch from c705fe7 to ae091b7 Compare June 17, 2026 05:45
Copilot AI review requested due to automatic review settings June 17, 2026 08:00
@Byron Byron force-pushed the fix-aut-joined-short-bypass-2 branch from ae091b7 to 6762a2c Compare June 17, 2026 08:00

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.

Comment thread git/cmd.py Outdated
Comment thread test/test_git.py
Comment thread test/test_clone.py
Comment thread test/test_clone.py
@Byron Byron force-pushed the fix-aut-joined-short-bypass-2 branch from 6762a2c to 0d88094 Compare June 17, 2026 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants