test(git): Explicitly test for git injection attacks#17253
Conversation
|
r? @weihanglo rustbot has assigned @weihanglo. Use Why was this reviewer chosen?The reviewer was selected based on:
|
There was a problem hiding this comment.
There aren't any other user controlled parameters to git. It would be good to harden this with --end-of-options but we would then need to set a minimum git version so figured I'd pass for now as the needed versions aren't as universally available yet.
This reminds me: What is the minimal supported Git version we have?
There was a problem hiding this comment.
I'm not aware of us specifying it or what it would be.
This comment has been minimized.
This comment has been minimized.
See https://nesbitt.io/2026/07/21/end-of-options.html While Cargo does support using the git cli, we are not subject to this because - we require URLs to be used in the `Cargo.toml`, `.cargo/config.toml` parser for git sources - we always prefix branches, revs, and tags or don't use them Tests are added to demonstrate this. I wasn't exhaustive (`patch`, `tag`, more `rev` kinds) but figured this was approriate based on source code inspection. There aren't any other user controlled parameters to git. It would be good to harden this with `--end-of-options` but we would then need to set a minimum git version so figured I'd pass for now as the needed versions aren't as universally available yet.
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Update cargo submodule 17 commits in 3efb1f477e99b42974b982d939fd100303cdf7db..54b61f13a4eea47ec3ee95237d4107976d7909ed 2026-07-17 23:53:19 +0000 to 2026-07-24 13:23:18 +0000 - chore: bump to `libgit2-sys@0.18.7+1.9.6` (rust-lang/cargo#17259) - Enable build-dir layout v2 on nightly by default (rust-lang/cargo#17258) - fix(path): clarify error message when path dependency has wrong package (rust-lang/cargo#16927) - fix(toml): warn on hyphenated lint names and duplicates (rust-lang/cargo#17051) - fix(test): gate trim-paths tests on split debuginfo support (rust-lang/cargo#17256) - test(git): Explicitly test for git injection attacks (rust-lang/cargo#17253) - fix(git): Suggest libgit2 if git-cli fails (rust-lang/cargo#17252) - fix(diag): bound transitive unused dependency traversal (rust-lang/cargo#17251) - fix(git): Hide git fetch output without progress (rust-lang/cargo#17243) - revert(lint): Remove `new_implicit_minimum_version_req` (rust-lang/cargo#16321) (rust-lang/cargo#17249) - fix: Add haiku's dylib path (rust-lang/cargo#17248) - Zsh completion: Add `-p` and `--package` flags for `cargo add` (rust-lang/cargo#17247) - refactor(source): Clarify the name of the remote git registry (rust-lang/cargo#17240) - fix(timings): only report units the job queue actually ran (rust-lang/cargo#17238) - Do not include proc-macro deps in rustc search path args (rust-lang/cargo#17236) - chore(deps): update cargo-semver-checks to v0.49.0 (rust-lang/cargo#17237) - rustdoc: rename the doc parts metadata params (rust-lang/cargo#17234) r? ghost
Update cargo submodule 17 commits in 3efb1f477e99b42974b982d939fd100303cdf7db..54b61f13a4eea47ec3ee95237d4107976d7909ed 2026-07-17 23:53:19 +0000 to 2026-07-24 13:23:18 +0000 - chore: bump to `libgit2-sys@0.18.7+1.9.6` (rust-lang/cargo#17259) - Enable build-dir layout v2 on nightly by default (rust-lang/cargo#17258) - fix(path): clarify error message when path dependency has wrong package (rust-lang/cargo#16927) - fix(toml): warn on hyphenated lint names and duplicates (rust-lang/cargo#17051) - fix(test): gate trim-paths tests on split debuginfo support (rust-lang/cargo#17256) - test(git): Explicitly test for git injection attacks (rust-lang/cargo#17253) - fix(git): Suggest libgit2 if git-cli fails (rust-lang/cargo#17252) - fix(diag): bound transitive unused dependency traversal (rust-lang/cargo#17251) - fix(git): Hide git fetch output without progress (rust-lang/cargo#17243) - revert(lint): Remove `new_implicit_minimum_version_req` (rust-lang/cargo#16321) (rust-lang/cargo#17249) - fix: Add haiku's dylib path (rust-lang/cargo#17248) - Zsh completion: Add `-p` and `--package` flags for `cargo add` (rust-lang/cargo#17247) - refactor(source): Clarify the name of the remote git registry (rust-lang/cargo#17240) - fix(timings): only report units the job queue actually ran (rust-lang/cargo#17238) - Do not include proc-macro deps in rustc search path args (rust-lang/cargo#17236) - chore(deps): update cargo-semver-checks to v0.49.0 (rust-lang/cargo#17237) - rustdoc: rename the doc parts metadata params (rust-lang/cargo#17234) r? ghost
What does this PR try to resolve?
See https://nesbitt.io/2026/07/21/end-of-options.html
While Cargo does support using the git cli, we are not subject to this because
Cargo.toml,.cargo/config.tomlparser for git sourcesTests are added to demonstrate this.
I wasn't exhaustive (
patch,tag, morerevkinds) but figured this was approriate based on source code inspection.There aren't any other user controlled parameters to git. It would be good to harden this with
--end-of-optionsbut we would then need to set a minimum git version so figured I'd pass for now as the needed versions aren't as universally available yet.How to test and review this PR?