Skip to content

Pin cargo-binstall by version and digest, not curl|bash of main - #23

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

Pin cargo-binstall by version and digest, not curl|bash of main#23
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 one unpinned, unverified execution path in a script where every other tool is version-pinned and every sibling checkout under .deps/ is rev-pinned.

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.

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 job runs ./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

Fixes #22.

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 and every sibling checkout under .deps/ is
rev-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 8710d2e into main Aug 6, 2026
1 check passed
@lann
lann deleted the binstall-digest-pin branch August 6, 2026 12:00
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.

setup.sh: cargo-binstall bootstrap is an unpinned curl|bash — digest-pin it

1 participant