Skip to content

setup.sh: pin cargo-binstall by version and digest, not curl|bash of main - #342

Merged
lann merged 1 commit into
mainfrom
binstall-digest-pin
Aug 6, 2026
Merged

setup.sh: pin cargo-binstall by version and digest, not curl|bash of main#342
lann merged 1 commit into
mainfrom
binstall-digest-pin

Conversation

@lann

@lann lann commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

scripts/setup.sh piped cargo-binstall's install-from-binstall-release.sh from the upstream repo's main branch straight into bash — the unpinned, unverified execution path #34 calls out ("the cargo-binstall bootstrap is curl | bash from a mutable main ref").

Now install_binstall downloads the v1.21.1 release asset for the host platform directly (no bootstrap script), verifies it against the committed scripts/cargo-binstall.sha256, and fails closed on a digest mismatch or an unrecorded asset. Platforms without a pinned asset fall back to cargo install --locked --version (registry checksums). Bumping the version means re-recording the digests deliberately. Ported from polymorph-components/polymorph-websocket#30; the digest file is byte-identical.

This addresses the pin-the-bootstrap half of #34's third checklist item; the verify-installed-versions-against-the-pins half (and the rest of #34) remains open.

Verification:

  • the three pinned digests match the GitHub release API's published digests for v1.21.1 (the current latest), independently recomputed from downloaded assets
  • happy path exercised for real on Linux/aarch64 against this script: the binary lands executable in ~/.cargo/bin and reports 1.21.1; this PR's own CI exercises the x86_64 path, since the ci.yml, pages, and timing-lab jobs run ./scripts/setup.sh
  • tamper test against this script: a flipped digest exits 1 with the diagnostic and installs nothing
  • archive layouts checked against the extraction commands: single root-level member; the darwin zip carries mode 0755, so unzip restores the exec bit
  • shellcheck v0.11.0 clean

…main

The cargo-binstall bootstrap piped install-from-binstall-release.sh
from the upstream repository's main branch straight into bash: the one
unpinned, unverified execution path in a script where every other tool
is version-pinned. Now the release asset for the host platform is
downloaded directly from the v1.21.1 release and verified against
scripts/cargo-binstall.sha256 before it runs. A digest mismatch or an
unrecorded asset fails closed; platforms without a pinned asset fall
back to cargo install --locked (registry checksums). Bumping the
version means re-recording the digests deliberately.
@lann
lann enabled auto-merge August 6, 2026 11:45
@lann
lann merged commit 307dd44 into main Aug 6, 2026
6 checks passed
@lann
lann deleted the binstall-digest-pin branch August 6, 2026 11:55
lann added a commit that referenced this pull request Aug 6, 2026
The two wpt-parity-webkit jobs installed just by piping
just.systems/install.sh into bash: version-pinned but a floating,
unverified script — the same shape #342 removed from setup.sh. The
comment's excuse ("this job skips the Rust toolchain, so it cannot
use setup.sh's cargo-binstall path") turns out to be false:
binstall's prebuilt strategy needs no cargo at all.

setup.sh's digest-verified bootstrap moves to
scripts/install-binstall.sh, shared by setup.sh and the two jobs,
which now install just with cargo-binstall --disable-strategies
compile (fail closed rather than presume a toolchain). just's own
bytes stay trusted via crates.io metadata + GitHub TLS, like every
other binstall-installed tool; byte-pinning the tools themselves is
the still-open half of #34.
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.

1 participant