← Winnitude! Search  ·  Reader Mode (1050 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 47 LINKS

fix: prevent environment expansion in remote URLs by Byron · Pull Request #2181 · gitpython-developers/GitPython

Repository navigation

fix: prevent environment expansion in remote URLs - #2181


Merged
Byron merged 1 commit into main from fix-env-var-exfiltration Jul 22, 2026
Merged

fix: prevent environment expansion in remote URLs #2181 Byron merged 1 commit into main from fix-env-var-exfiltration

Conversation

Byron commented Jul 22, 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.

Summary

Preserve caller-supplied environment-variable references literally when creating remotes and submodules. This closes the remaining sibling URL paths missed by the earlier clone hardening while retaining existing local-path normalization behavior.

Advisory summary

The advisory remains in triage, so reproduction and exploit details are intentionally omitted here.

Validation

  • Focused remote and submodule regression tests: 2 passed
  • Changed-file pre-commit hooks: passed
  • git diff --check: passed
  • Full remote/submodule modules: 56 passed, 1 skipped; 14 fixture failures from unavailable nested test repositories and a historical master-branch fixture
  • Codex commit review: no correctness findings
fix: prevent environment expansion in remote URLs View comments on this commit 8634174
Remote and submodule creation expanded environment-variable references in
caller-supplied URLs before storing them in Git configuration. This could
expose process environment values through a later network request or a tracked
.gitmodules file.

Preserve variables literally in the remaining untrusted URL callers while
retaining Git.polish_url() expansion for intentional local-path normalization.
Add regression tests covering remote configuration and submodule configuration.

Git baseline: git remote add and git submodule add accept URL arguments
literally; Git does not perform shell-style environment expansion on those
arguments.

Co-authored-by: Sebastian Thiel <sebastian.thiel@icloud.com>
Byron force-pushed the fix-env-var-exfiltration branch from 333c6ba to 8634174
Compare
July 22, 2026 15:04 Byron marked this pull request as ready for review July 22, 2026 15:09 Copilot PR reviewer Copilot
AI
review requested due to automatic review settings July 22, 2026 15:09 Copilot started reviewing on behalf of Byron July 22, 2026 15:09
View session
Copilot PR reviewer Copilot
AI
reviewed Jul 22, 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 remote and submodule creation paths to preserve caller-supplied environment-variable references literally (e.g. ${VAR}) instead of expanding them via os.path.expandvars, aligning with the security advisory context.

Changes:

  • Disable variable/~ expansion when polishing URLs in Remote.create() by passing expand_vars=False.
  • Disable variable/~ expansion when polishing URLs written into submodule config by passing expand_vars=False.
  • Add regression tests covering remote creation and submodule add behavior under a patched environment.

Reviewed changes

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

File Description
git/remote.py Prevents env/~ expansion when adding a new remote by polishing URLs with expand_vars=False.
git/objects/submodule/base.py Prevents env/~ expansion when writing submodule URLs to config by polishing with expand_vars=False.
test/test_remote.py Adds a regression test ensuring ${VAR} in a remote URL is not expanded during create_remote.
test/test_submodule.py Adds a regression test ensuring ${VAR} in a local-path submodule URL is not expanded during Submodule.add.

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

Byron merged commit e227e01 into main Jul 22, 2026 31 checks passed vtsilytskyiTT mentioned this pull request Jul 23, 2026 [Security] Uplift Pillow and GitPython tenstorrent/tt-metal#50702 Merged Byron deleted the fix-env-var-exfiltration branch October 5, 2026 03:24 Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment

Labels

None yet

6 participants