fix: validate Rust toolchain lock surface - #173
Open
sylvesterkaczmarek wants to merge 2 commits 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
Validate the Rust toolchain lock's declared host, target, and host-component surface instead of relying only on the artifact records and hard-coded installer arrays.
Problem
.cargo/tooling/rust-toolchain.lock.tomlexplicitly records three reviewed declarations under[rust]:hosts,targets, andhost_components.script/vendor-rustgenerates those fields from the same authoritative arrays used by the installer.On the base commit,
script/validate-rust-toolchainnever reads those declarations. It correctly requires the individual 24 artifact records and, online, compares those records with the upstream Rust channel manifest, but the lock's own advertised surface can disagree with the records that are actually validated.That leaves a self-contradictory source-of-truth file: current code may behave safely because it ignores the declarations, while a reviewer or future consumer can reasonably interpret the recorded arrays as the lock's supported toolchain surface.
Evidence / reproduction
script/lib/rust-dist.bashdefines the reviewedRUST_DIST_HOSTS,RUST_DIST_TARGETS, andRUST_DIST_HOST_COMPONENTSarrays.rust_dist_write_lockfileserializes those arrays into[rust]ashosts,targets, andhost_components.script/validate-rust-toolchainuses the shell arrays to require each host/component and target artifact, and requires 24 artifact records, but on the base commit it does not parse or compare the three declared arrays.hosts = [...]in the committed lock to a shorter or reordered list while leaving all 24 artifact records, version, manifest URL, and checksums untouched. The base validator continues validating the artifact records and does not reject the contradictory declaration.Change
hosts,targets, andhost_componentsarrays to exactly match the existing authoritative Rust distribution arraysNo Rust version, artifact URL, checksum, supported platform, or installation behavior changes.