Skip to content

Install cargo tools with locked dependencies - #2986

Merged
jyn514 merged 1 commit into
rust-lang:mainfrom
konstin:konsti/cargo-install-locked
Aug 29, 2026
Merged

Install cargo tools with locked dependencies#2986
jyn514 merged 1 commit into
rust-lang:mainfrom
konstin:konsti/cargo-install-locked

Conversation

@konstin

@konstin konstin commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Installing cargo tools (cargo install) without locked dependencies exposes users to supply-chain attacks to all the dependencies of the tool (https://blog.rust-lang.org/2026/08/20/supply-chain-attack-on-arrayref/). Using cargo install --locked reduces this risk to a compromise of the tool itself, while using the locked and hashed version of the dependencies.

I went through all rg "cargo install" hits in the repository and added --locked to all but explanatory examples (such as cargo's docs on cargo install itself). I validated that those tools publish functioning Cargo.locks with https://gist.github.com/konstin/bcb1169c1c1120c259dca64e777a64d0.

See rust-lang/rust#161428.

Installing cargo tools (`cargo install`) without locked dependencies exposes users to supply-chain attacks to all the dependencies of the tool (https://blog.rust-lang.org/2026/08/20/supply-chain-attack-on-arrayref/). Using `cargo install --locked` reduces this risk to a compromise of the tool itself, while using the locked and hashed version of the dependencies.

I went through all `rg "cargo install"` hits in the repository and added `--locked` to all but explanatory examples (such as cargo's docs on `cargo install` itself). I validated that those tools publish functioning `Cargo.lock`s with https://gist.github.com/konstin/bcb1169c1c1120c259dca64e777a64d0.
@konstin
konstin marked this pull request as ready for review August 28, 2026 19:03
@rustbot

rustbot commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the PR. If you have write access, feel free to merge this PR if it does not need reviews. You can request a review using r? rustc-dev-guide or r? <username>.

@rustbot rustbot added the S-waiting-on-review Status: this PR is waiting for a reviewer to verify its content label Aug 28, 2026

@jyn514 jyn514 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

good catch, thanks :)

View changes since this review

@jyn514
jyn514 merged commit 6ea8505 into rust-lang:main Aug 29, 2026
2 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: this PR is waiting for a reviewer to verify its content label Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants