Skip to content

Install cargo tools with locked dependencies - #23248

Open
konstin wants to merge 1 commit into
rust-lang:masterfrom
konstin:konsti/cargo-install-locked
Open

Install cargo tools with locked dependencies#23248
konstin wants to merge 1 commit into
rust-lang:masterfrom
konstin:konsti/cargo-install-locked

Conversation

@konstin

@konstin konstin commented Aug 28, 2026

Copy link
Copy Markdown

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:07
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants