Require explicit opt-in for filesystem diffs by Byron · Pull Request #2217 · gitpython-developers/GitPython
Repository navigation
Require explicit opt-in for filesystem diffs - #2217
Merged
Byron merged 1 commit into main from fix-advisory Aug 17, 2026
Merged
Require explicit opt-in for filesystem diffs #2217 Byron merged 1 commit into main from fix-advisory
Conversation
Byron commented Aug 17, 2026 · edited Loading
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.
Advisory
GHSA-whh4-5q6c-9v3x reports a repository-boundary bypass in the high-level diff API. This change requires callers to explicitly opt in before diff paths may use filesystem-wide semantics. Reproduction mechanics are intentionally omitted while the advisory is unpublished.
Advisory summary
- Severity: medium
- Package: GitPython (pip)
- Affected range:
= 3.1.59 - Patched versions: none published
- CVE: none assigned
Changes
- Classify
--no-indexas an unsafe diff option. - Cover keyword and raw-option spellings through commit and index APIs.
- Clarify the existing explicit opt-in documentation.
Validation
- Focused diff security tests: 2 passed.
- Complete
test/test_diff.py: 25 passed, 1 unrelated local-environment failure in staged conflict reporting. - Ruff check and format checks passed.
git diff --checkpassed.- Git baseline: Git 2.50.1 documents filesystem operand behavior in
Documentation/git-diff.adocand implements it inbuiltin/diff.c. - Post-commit Codex review was attempted once for
14200584but the CLI usage allowance was exhausted before review began.
AI
lite review requested due to automatic review settings August 17, 2026 04:15 Copilot started reviewing on behalf of Byron August 17, 2026 04:17
View session
Copilot PR reviewer Copilot
AI
reviewed Aug 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 hardens GitPython's high-level diff APIs against repository-boundary bypass by requiring explicit caller opt-in before enabling filesystem-wide diff semantics (--no-index).
Changes:
- Mark
--no-indexas an unsafe diff option (requiresallow_unsafe_options=True). - Add regression tests ensuring both keyword (
no_index=True) and raw-option ("--no-index") spellings are rejected by default. - Update
Diffable.diffdocumentation to include--no-indexin the unsafe-options description.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
test/test_diff.py |
Adds tests that --no-index/no_index are blocked unless explicitly allowed. |
git/repo/base.py |
Adds --no-index to the repo's unsafe diff option allowlist/denylist used by high-level diff APIs. |
git/diff.py |
Updates the allow_unsafe_options docstring to document --no-index as unsafe. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
AI
review requested due to automatic review settings August 17, 2026 04:34 Copilot started reviewing on behalf of Byron August 17, 2026 04:34
View session
Copilot PR reviewer Copilot
AI
reviewed Aug 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 3 out of 3 changed files in this pull request and generated no new comments.
Byron force-pushed the fix-advisory branch fromdf56a12 to
60f9e66
Compare
August 17, 2026 04:45
fix: require opt-in for no-index diffs
09f2cf3
<!-- agent --> Treat --no-index as an unsafe diff option because it changes path operands from repository pathspecs to arbitrary filesystem paths. This addresses GHSA-whh4-5q6c-9v3x without exposing advisory reproduction details. Assisted-by: GPT 5.6 Co-authored-by: GPT 5.6 <codex@openai.com>Copilot PR reviewer Copilot
AI
review requested due to automatic review settings August 17, 2026 04:47 Byron force-pushed the fix-advisory branch from
60f9e66 to
09f2cf3
Compare
August 17, 2026 04:47 Copilot started reviewing on behalf of Byron August 17, 2026 04:48
View session
Copilot PR reviewer Copilot
AI
reviewed Aug 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 4 out of 4 changed files in this pull request and generated no new comments.
Byron merged commitd160fb4
into
main
Aug 17, 2026
54 checks passed
Byron
deleted the
fix-advisory
branch
October 5, 2026 03:24
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