GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: complete safety checks in Git command wrappers by Byron · Pull Request #2251 · gitpython-developers/GitPython

Conversation

@Byron

@Byron Byron commented Sep 26, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Tasks

This section is for Byron only. Models continuing this PR must not add, remove, check, uncheck, rename, or reorder checkboxes here.

  • refackiew

Everything below this line was generated by Codex GPT-6.

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

Apply the existing safety guards consistently to Git.ls_remote(), Repo.merge_base(), and IndexFile.move(), retaining explicit unsafe opt-ins. merge_base() now propagates command failures except for Git's status 1 result when no common ancestor exists.

The shared protocol check follows Git's transport-selector syntax, preserving ordinary IPv6 URLs and double colons in repository paths. Protocol-like positional arguments and split short-option values require an opt-in; long-form server options remain available. The option checks for merge_base() and move() align their policy with sibling APIs; current Git versions already reject those denylisted options for these two subcommands.

Advisory summary

GHSA-w8jc-g24h-crhw

  • Severity: high; CVSS 3.1 score 7.5.
  • Package: GitPython on PyPI; reported affected range <= 3.1.62.
  • No patched version or CVE ID is assigned in the advisory.

The advisory is unpublished. Private reproduction and exploit details are omitted.

Validation

Regression cases failed before the fix. On Python 3.14.7 with Git 2.54.0 (Apple Git-157):

  • Guard and positional-argument suites: 95 passed.
  • Targeted existing guard, protocol, archive, move, and merge-base checks: 133 passed.
  • Pre-commit checks passed for all four changed files.
  • mypy: clean across 46 source files.
  • basedpyright --warnings: no errors or warnings.
  • codex review --commit c480bd5: no actionable findings.

Git behavior was checked against git/git@d38352cd43ab9745686d697872408bc3249a153f, specifically builtin/ls-remote.c, transport.c, builtin/merge-base.c, builtin/mv.c, url.c, and parse-options.c.

Commit: c480bd5 — fix: complete safety checks in Git command wrappers.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Byron @codex
fix: complete safety checks in Git command wrappers
9ad28cc
Mostly a rubber-stamp, particularly the tests I just skimmed.
It's also a common fix just with unsafe-options guards, and
a regex fix which hopefully is truly better than before.
I didn't question it in the interest of time.

<!-- agent -->
Address GHSA-w8jc-g24h-crhw by applying the existing guard policy to
`Git.ls_remote()`, `Repo.merge_base()`, and `IndexFile.move()`. These wrappers
previously omitted protocol or option checks already used by sibling APIs.

Check flattened positional arguments and split short-option values before
`ls_remote()` starts Git, including values that become the repository after
option parsing. Add the independent `allow_unsafe_protocols` opt-in and recognize
helper selectors even when their address is empty or begins with a newline.
Match Git's scheme-character rules at the start of the address so ordinary
IPv6 URLs and double colons in repository paths retain their meaning. This
addresses the review finding that the broad matcher rejected valid IPv6 remotes.
The protocol check is conservative for positional and split option values;
long-form `server_option` values remain available without a protocol opt-in.

Reuse the revision and pathspec option guards in `merge_base()` and `move()`,
with explicit `allow_unsafe_options` opt-ins. Git currently rejects these
denylisted options for those subcommands; the checks keep their policy aligned
with sibling APIs. Preserve literal move operands behind `--` and validate
options before either the dry run or actual move.

Only treat exit status 1 from `merge_base()` as no common ancestor. Other
failures, including invalid options, now propagate as `GitCommandError`
instead of silently returning an empty list.

Git reference: `git/git@d38352cd43ab9745686d697872408bc3249a153f`, inspected in
`builtin/ls-remote.c`, `transport.c`, `builtin/merge-base.c`, `builtin/mv.c`,
`url.c`, and `parse-options.c`. These confirm option parsing before the remote operand,
helper selection independently of address contents, long-option abbreviations,
and status 1 for unrelated histories.

Assisted-by: GPT 6.0
Co-authored-by: GPT 6.0 <[email protected]>
@Byron
Byron force-pushed the arg-bypass branch from c480bd5 to 9ad28cc Compare September 27, 2026 05:43
@Byron
Byron marked this pull request as ready for review September 27, 2026 05:44
Copilot AI lite review requested due to automatic review settings September 27, 2026 05:44
Copilot started reviewing on behalf of Byron September 27, 2026 05:46
View session
Copilot AI reviewed Sep 27, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

Copilot review overview

🟡 Changes recommended

Unresolved critical release consistency and moderate correctness issues remain.

Review effort: Lite
Findings: 1 High severity

Open (1)
  • High severity Update VERSION to match the new release heading · New
What changed in this PR

This PR adds safety guards to Git command wrappers and improves merge_base() error handling.

Changes:

  • Guards ls_remote(), merge_base(), and IndexFile.move().
  • Adds regression tests for unsafe protocols, options, and merge-base failures.
  • Documents the security fixes.
File Summary Review notes
test/​test_command_guards.py Adds regression coverage for command guards. No issues noted.
git/​repo/​base.py Validates merge-base options and propagates failures. Moderate issue: status 1 is mishandled with is_ancestor.
git/​index/​base.py Adds unsafe option validation for moves. Nit: reference git-mv(1) instead of git-rm(1).
git/​cmd.py Adds protocol and option checks to ls_remote(). Moderate issue: boolean keyword values can cause a TypeError.
doc/​source/​changes.rst Documents the security release. Critical version mismatch; nit: add the required release URL.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread doc/source/changes.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@Byron
Byron merged commit 73a72c9 into main Sep 27, 2026
51 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@Byron
Byron deleted the arg-bypass branch October 5, 2026 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

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.

2 participants

@Byron
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.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.