fix: preserve literal clone URLs#2172
Draft
Byron wants to merge 1 commit into
Draft
Conversation
2e0a04b to
4db3773
Compare
Repo.clone_from() expanded environment-variable references in caller-supplied URLs before passing them to git clone. This could expose process environment values to an untrusted remote and made protocol validation apply to a different value than Git received. Polish clone URLs without variable or home expansion on native and Cygwin Git, then apply unsafe-protocol validation to that exact normalized value. Preserve the literal URL when normalizing the stored origin after a successful clone, while retaining the existing Git.polish_url() default for callers that intentionally normalize local paths. Add regression coverage for POSIX and Windows variable syntax, Cygwin conversion, stored origins, and post-normalization protocol validation. Git baseline: git clone passes URL arguments through literally; t/t5601-clone.sh covers the accepted URL forms without shell-style environment expansion. Security: GHSA-rwj8-pgh3-r573. Validation: - pytest test/test_clone.py -q (21 passed, 1 skipped) - pytest test/test_util.py -q - ruff check on changed files - ruff format --check on changed files - full pytest suite (681 passed, 73 skipped, 1 xfailed; 7 unrelated environment/baseline failures)
4db3773 to
6575026
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Tasks
This section is for Byron only. Models continuing this PR must not add, remove, check, uncheck, rename, or reorder checkboxes here.
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
Preserve caller-provided clone URLs literally when invoking Git and when storing the resulting origin URL. Validate unsafe protocols against the exact normalized value passed to Git. Legacy expansion remains available to callers that intentionally normalize local paths.
Security advisory
GHSA-rwj8-pgh3-r573Advisory summary
gitpython(pip)<= 3.1.50The advisory remains a draft, so this description intentionally omits exploit details.
Validation
pytest test/test_clone.py -q— 20 passed, 1 skippedruff checkon changed files — passedruff format --checkon changed files — passedpytest -q— 681 passed, 73 skipped, 1 xfailed; 7 unrelated local environment/baseline failures (including tests that assume amasterdefault branch and local daemon/config behavior)Git behavior reference
Git passes clone URL arguments through literally;
t/t5601-clone.shexercises accepted clone URL forms without shell-style environment expansion.