Skip to content

Install cargo tools with locked dependencies - #5295

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

Install cargo tools with locked dependencies#5295
RalfJung 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 "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.
@rustbot rustbot added the S-waiting-on-author Status: Waiting for the PR author to address review comments label Aug 28, 2026
@konstin
konstin marked this pull request as ready for review August 28, 2026 19:08
@rustbot rustbot added S-waiting-on-review Status: Waiting for a review to complete and removed S-waiting-on-author Status: Waiting for the PR author to address review comments labels Aug 28, 2026
@RalfJung
RalfJung added this pull request to the merge queue Aug 29, 2026
@RalfJung

Copy link
Copy Markdown
Member

Makes sense, thanks!

Merged via the queue into rust-lang:master with commit a641c83 Aug 29, 2026
14 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Waiting for a review to complete 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