Repository navigation
Open
Description
Problem
packages/containers/bun-node/Dockerfile installs Bun with curl -fsSL https://bun.sh/install | bash -s -- "bun-v${BUN_VERSION}". Nothing verifies the bytes. The version is pinned (from package.json packageManager since #226), but the artifact is not, so a compromised bun.sh or a swapped release asset would go into every image built from it. This was raised in the #226 review and deferred there because the fix needs per-arch plumbing that could not be verified locally.
Why it is not a one-liner
packages/containers/script/build.tspusheslinux/amd64,linux/arm64, so each Bun bump needs at least two checksums:bun-linux-x64.zipandbun-linux-aarch64.zip.- The install script picks
bun-linux-x64-baseline.zipon x64 hosts without AVX2. A checksum install has to choose one variant explicitly. Baseline is the safe default for a CI image. - The base image is
ghcr.io/anomalyco/build/base:24.04, so the change has to be tested withdocker buildxon both platforms.
Proposed design
- Add a checked-in
packages/containers/bun-node/bun.sha256inSHASUMS256.txtformat, holding only the needed assets (bun-linux-x64-baseline.zip,bun-linux-aarch64.zip) for the pinned version. That file is the one place to update on a Bun bump: copy the two lines from that release'sSHASUMS256.txt, after checking it against the release's signedSHASUMS256.txt.asc. - In the Dockerfile,
COPYthat file and mapTARGETARCHto the asset name (amd64tox64-baseline,arm64toaarch64). Downloadhttps://github.com/oven-sh/bun/releases/download/bun-v${BUN_VERSION}/bun-linux-${asset}.zip, rungrep " bun-linux-${asset}.zip$" bun.sha256 | sha256sum -c -, and unzip into/opt/bun/bin(the currentBUN_INSTALL). Dropcurl | bash. - Extend
packages/cli/test/cli/bun-version-pin.test.tsso thatbun.sha256lists both assets, and the Dockerfile no longer pipesbun.sh/installinto a shell. - Add a line to the RELEASING.md "Bun version" section: a bump updates
packageManagerandbun.sha256together.
Acceptance criteria
docker buildx build --platform linux/amd64,linux/arm64ofbun-nodesucceeds with the pinned checksums. It fails if one byte of either checksum is changed.bun --versionin both images equals thepackageManagerversion.- The pin test covers both invariants in step 3.
Metadata
Metadata
Assignees
Labels
No labels
Activity
build: SHA-pin actions/checkout and harden the Bun pin test (#226 rev…