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 — Block file-reading Git options by Byron · Pull Request #2208 · gitpython-developers/GitPython

Conversation

@Byron

@Byron Byron commented Aug 5, 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-5.

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

Summary

  • Reject file-reading options passed to blame APIs, including equivalent short and clustered forms.
  • Inspect positional tag path/reference inputs and the legacy ref alias for unsafe file options.
  • Reject the adjacent diff order-file input, including clustered forms, while preserving safe -S pickaxe behavior.

Advisories

  • GHSA-5xxx-qhh7-9287
  • GHSA-3wxw-xv34-2frg

Advisory summary

Both advisories are medium severity and affect the pip package GitPython through version 3.1.58. No patched version or CVE has been assigned yet. The change prevents caller-controlled Git options from reading local files through high-level blame and tag APIs, and closes the same class of issue in diff order-file handling.

Validation

  • Focused regression tests: 4 passed
  • test_diff.py: 23 passed; 1 unrelated local branch-fixture failure
  • test_repo.py and test_refs.py: 108 passed, 2 skipped; 5 unrelated local environment/history failures
  • Ruff on changed files
  • git diff --check
  • Codex commit review: no actionable findings after follow-up fixes

Git behavior reference: git.git cf5497b14c, including the documented file-input options for git blame, git diff, and git tag.

Sorry, something went wrong.

Uh oh!

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

chatgpt-codex-connector[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@Byron
Byron force-pushed the security-fixes branch 2 times, most recently from 97ee736 to 91821bd Compare August 5, 2026 05:15
@Byron
Byron marked this pull request as ready for review August 5, 2026 05:15
Copilot AI lite review requested due to automatic review settings August 5, 2026 05:15
Copilot started reviewing on behalf of Byron August 5, 2026 05:16
View session
Copilot AI reviewed Aug 5, 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.

Pull request overview

This PR tightens GitPython’s unsafe-option filtering to prevent caller-controlled Git options from reading (or writing) arbitrary local files through higher-level APIs (blame, tag creation, and diff), aligning with the referenced security advisories.

Changes:

  • Extend unsafe option blocks for Repo.blame() / Repo.blame_incremental() (e.g., --contents, -S, --ignore-revs-file) including clustered short-option forms.
  • Extend unsafe option blocks for diff APIs to reject -O (orderfile) including clustered forms while preserving safe -S pickaxe usage.
  • Expand unsafe-option parsing to accept per-command “clusterable short options” so sequences like -wS... and -pO... are detected.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/test_repo.py Adds regression coverage for newly blocked blame option spellings (including clustered short options).
test/test_refs.py Adds regression coverage for unsafe tag message file options via positional args and legacy ref alias.
test/test_diff.py Adds regression coverage for diff -O (orderfile) blocking and clustered forms; ensures -S remains allowed.
git/repo/base.py Introduces per-command unsafe option lists for blame and diff; wires them into blame checks.
git/refs/tag.py Expands tag unsafe-option checking to include positional inputs and ref-alias-sourced reference.
git/index/base.py Switches index diff unsafe option list to the new diff-specific unsafe set and cluster parsing.
git/diff.py Switches diff unsafe option list to the new diff-specific unsafe set and cluster parsing; updates docs.
git/cmd.py Adds configurable clusterable-short-option support to Git.check_unsafe_options.

💡 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.

All reactions
Comment thread git/refs/tag.py Resolved

Uh oh!

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

Copilot AI review requested due to automatic review settings August 5, 2026 05:21
Copilot started reviewing on behalf of Byron August 5, 2026 05:23
View session
Copilot AI reviewed Aug 5, 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.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Suppressed comments (2)

git/refs/tag.py:139

  • The legacy ref kwarg is used as an alias for the reference argument, but it is left in kwargs. Since repo.git.tag(*args, **kwargs) transforms kwargs into CLI options, this will pass an unsupported --ref=... option to git tag and can break callers using ref=. Pop it from kwargs when consuming it as an alias.
        if "ref" in kwargs and kwargs["ref"]:
            reference = kwargs["ref"]

test/test_diff.py:394

  • The unsafe-diff option tests cover -O/clustered forms but not the equivalent long form --orderfile (or the orderfile= kwarg), which should be blocked for the same reason. Add regression coverage so bypasses via long-option spelling are caught.
        calls = (
            lambda target: commit.diff(output=target),
            lambda target: commit.diff(other=f"--output={target}"),
            lambda target: commit.diff(O=target),
            lambda target: commit.diff(other=f"-pO{target}"),

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread git/repo/base.py Resolved

Uh oh!

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

Copilot AI review requested due to automatic review settings August 5, 2026 06:26
@Byron
Byron force-pushed the security-fixes branch from 44368bf to bfc89bd Compare August 5, 2026 06:26
Copilot started reviewing on behalf of Byron August 5, 2026 06:28
View session
Copilot AI reviewed Aug 5, 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.

Pull request overview

Copilot reviewed 11 out of 11 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.

All reactions
Byron and others added 2 commits August 5, 2026 08:36
@Byron @codex
Block file-reading Git options
1b0d2d9
<!-- agent -->
Reject file-reading options passed to blame, diff, and tag APIs. Inspect
positional values after resolving aliases, recognize unsafe options
behind command-specific short-flag clusters, and retain the explicit
allow_unsafe_options escape hatch. This closes GHSA-5xxx-qhh7-9287 and
GHSA-3wxw-xv34-2frg and covers the adjacent diff order-file sink.

Regression tests cover long, short, and clustered options, incremental blame,
tag path/reference positionals, the ref keyword alias, both diff entry points,
and preservation of diff pickaxe behavior.

Git baseline: cf5497b14c; git-blame, git-diff, and git-tag document the relevant file-input options.

Assisted-by: GPT 5.6
Co-authored-by: GPT 5.6 <[email protected]>
@Byron
prepare next release
ce9d8e8
Copilot AI review requested due to automatic review settings August 5, 2026 06:36
@Byron
Byron force-pushed the security-fixes branch from bfc89bd to ce9d8e8 Compare August 5, 2026 06:36
Copilot started reviewing on behalf of Byron August 5, 2026 06:38
View session
Copilot AI reviewed Aug 5, 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.

Pull request overview

Copilot reviewed 10 out of 10 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.

All reactions
@Byron
Byron merged commit 9729ed3 into main Aug 5, 2026
54 checks passed

Uh oh!

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

Copilot AI mentioned this pull request Sep 18, 2026
Bump GitPython to 3.1.59 for CVE-2026-78679 microsoft/repoclassbench#33
Merged
@Byron
Byron deleted the security-fixes branch October 5, 2026 03:24
@p-linnane p-linnane mentioned this pull request Oct 31, 2026
Should GHSA-whh4-5q6c-9v3x cover releases before 3.1.59? #2330
Closed
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 01402503 — 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.