The Pi image builds from a pinned pi-gen commit and a checksummed Deno (#907)

The Pi build downloaded pi-gen's `arm64` branch head as a zip and ran it as root, and
downloaded Deno without checking it, so a forged TLS certificate (as the eMudhra key
compromise allowed) could change what went into the image.  pi-gen is now fetched by
commit hash, which git verifies against the objects, and the Deno zip is checked
against the same sha256 the other installers pin.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
lrnselfreliance 2026-10-30 20:36:00 -06:00 • committed by GitHub
parent 2caa2609ec
commit dc3a8bb313
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 4 deletions

View file

@ -108,10 +108,15 @@ fi
chattr -i "${BUILD_DIR}"/work/*/stage*/rootfs/opt/wrolpi-blobs/* 2>/dev/null || :
rm -rf "${BUILD_DIR}" /var/tmp/pi-gen-arm64 /var/tmp/arm64.zip
# Get the latest pi-gen code. The `arm64` branch builds trixie (Debian 13).
wget https://github.com/RPi-Distro/pi-gen/archive/refs/heads/arm64.zip -O /var/tmp/arm64.zip
unzip /var/tmp/arm64.zip -d /var/tmp
mv /var/tmp/pi-gen-arm64 "${BUILD_DIR}"
# pi-gen runs as root and builds the image, so it is fetched by commit hash: git verifies the objects against the
# hash, so the build runs this exact pi-gen even if the TLS connection was intercepted. The commit is on the
# `arm64` branch, which builds trixie (Debian 13). Bump it deliberately to take pi-gen updates.
PI_GEN_COMMIT=c851f00178c64b87a86c06c2be216bd89d62e55b
git init -q "${BUILD_DIR}" &&
git -C "${BUILD_DIR}" fetch -q --depth 1 https://github.com/RPi-Distro/pi-gen.git "${PI_GEN_COMMIT}" &&
git -C "${BUILD_DIR}" checkout -q FETCH_HEAD || { echo "ERROR: Failed to fetch pi-gen ${PI_GEN_COMMIT}"; exit 1; }
[ "$(git -C "${BUILD_DIR}" rev-parse HEAD)" = "${PI_GEN_COMMIT}" ] || \
{ echo "ERROR: pi-gen is not at ${PI_GEN_COMMIT}"; exit 1; }
# Copy the configuration and build files into the pi-gen directory.
cp "${SCRIPT_DIR}/config.txt" "${BUILD_DIR}/config.txt"

View file

@ -26,7 +26,9 @@ npm i -g serve@12.0.1 single-file-cli@2.0.73 readability-extractor@0.0.6
# Install Deno runtime.
DENO_VERSION="v2.8.3"
DENO_SHA256="d4589cc1ffcbf1995c92a0127d932aaf832ac70cfdcc6d5b7bf38043cf303575"
curl -fsSL "https://github.com/denoland/deno/releases/download/${DENO_VERSION}/deno-aarch64-unknown-linux-gnu.zip" -o /tmp/deno.zip
echo "${DENO_SHA256} /tmp/deno.zip" | sha256sum -c -
unzip /tmp/deno.zip -d /usr/local/bin/
chmod +x /usr/local/bin/deno
rm /tmp/deno.zip