Skip to content

Install cargo tools with locked dependencies - #547

Merged
programmerjake merged 1 commit into
rust-lang:masterfrom
konstin:konsti/cargo-install-locked
Aug 28, 2026
Merged

Install cargo tools with locked dependencies#547
programmerjake merged 1 commit into
rust-lang:masterfrom
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 --hidden "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:10
@programmerjake
programmerjake merged commit fea99be into rust-lang:master Aug 28, 2026
61 checks passed
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.

2 participants