fix: validate update-tool binary identities - #166
Open
sylvesterkaczmarek wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Make the committed update-tool lock validator verify each tool's expected executable identity, not only its crate name, version, URL, and checksums.
Problem
.cargo/tooling/update-tools.lock.tomlrecords both the cratenameand installedbinaryforcargo-auditandcargo-deny.script/validate-update-toolscurrently requires the binary field to be non-empty but never checks its value.That creates an internal contract mismatch: the lock can pass the normal CI validation path with a wrong binary name, then fail later only when
script/updatecallsinstall_locked_update_tool, whose installer independently requires the locked binary to match the executable it was asked to install.Evidence / reproduction
name = "cargo-audit"/binary = "cargo-audit"andname = "cargo-deny"/binary = "cargo-deny".script/validate-update-toolsvalidates the tool name, version, expected crates.io URL, crate digest, and packaged lockfile digest, but on the base commit it only checks thatbinaryis non-empty.script/lib/update-tools.bash::install_locked_update_toollater contains an explicit binary-mismatch failure, so the installer already treats the binary identity as part of the lock contract.script/validate-locksrunsscript/validate-update-toolsin both local and CI validation, so this is the boundary where a malformed committed lock should be rejected.binary = "cargo-audit"to another non-empty value while leaving the crate/version/URL/digests untouched. The lock validator accepts that field, but the subsequent update-tool installation rejects it as a binary mismatch.Change
Require the binary to equal the reviewed tool identity for the two supported update tools (
cargo-auditandcargo-deny) during lock validation.This is a four-line validation change. No tool versions, downloads, runtime behavior, or update workflow semantics change.