Skip to content

Block unsafe underscored git kwargs / Fix for GHSA-rpm5-65cw-6hj4#2131

Open
WesR wants to merge 3 commits intogitpython-developers:mainfrom
WesR:main
Open

Block unsafe underscored git kwargs / Fix for GHSA-rpm5-65cw-6hj4#2131
WesR wants to merge 3 commits intogitpython-developers:mainfrom
WesR:main

Conversation

@WesR
Copy link
Copy Markdown

@WesR WesR commented Apr 21, 2026

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a 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 addresses GHSA-rpm5-65cw-6hj4 by ensuring unsafe git options are blocked even when supplied via underscored kwarg names (e.g., upload_pack), and expands test coverage to prevent regressions.

Changes:

  • Canonicalize option/kwarg names (strip -/--, drop values, convert _-) before performing unsafe-option checks.
  • Extend remote/clone tests to include underscored unsafe kwargs.
  • Add a focused unit test ensuring check_unsafe_options catches multiple normalized forms.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
git/cmd.py Adds option-name canonicalization and uses it to match unsafe options robustly across kwarg/CLI forms.
test/test_remote.py Expands fetch/pull/push unsafe option tests to include underscored kwargs.
test/test_git.py Adds direct unit tests for Git.check_unsafe_options normalization behavior.
test/test_clone.py Expands clone/clone_from unsafe option tests to include underscored kwargs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread git/cmd.py Outdated
Comment thread test/test_remote.py Outdated
Copy link
Copy Markdown
Member

@Byron Byron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

This looks good enough to me, but let's wait for Copilot.

Comment thread git/cmd.py Outdated
Copy link
Copy Markdown
Member

@Byron Byron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's address the concerns stated in the auto review.

@WesR
Copy link
Copy Markdown
Author

WesR commented Apr 21, 2026

Done!

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