Skip to content

Commit c681d35

Browse files
committed
chore: apply AI code review suggestions
- homebrew: use 'curl -fLsS' for checksum downloads so a missing core asset hard-fails the job under always() instead of baking a corrupt sha256 into the formula (coderabbit) - musl zig setup: verify the Zig tarball with minisign against the official ziglang.org public key before extracting/executing it (coderabbit)
1 parent 8591629 commit c681d35

2 files changed

Lines changed: 18 additions & 7 deletions

File tree

.github/workflows/release-please.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,17 @@ jobs:
185185
VERSION=${{ needs.release-please.outputs.tag_name }}
186186
VERSION_NO_V=${VERSION#v}
187187
188-
# Download checksums
189-
curl -L -o darwin-x64.sha256 \
188+
# Download checksums. -f makes curl fail (non-zero) on a 404 instead of
189+
# writing an HTML error page into the .sha256 file — so when a core
190+
# target is missing under always(), this job hard-fails rather than
191+
# baking a corrupt checksum into the formula.
192+
curl -fLsS -o darwin-x64.sha256 \
190193
"https://github.com/${{ github.repository }}/releases/download/${VERSION}/csp-darwin-x64.sha256"
191-
curl -L -o darwin-arm64.sha256 \
194+
curl -fLsS -o darwin-arm64.sha256 \
192195
"https://github.com/${{ github.repository }}/releases/download/${VERSION}/csp-darwin-arm64.sha256"
193-
curl -L -o linux-x64.sha256 \
196+
curl -fLsS -o linux-x64.sha256 \
194197
"https://github.com/${{ github.repository }}/releases/download/${VERSION}/csp-linux-x64.sha256"
195-
curl -L -o linux-arm64.sha256 \
198+
curl -fLsS -o linux-arm64.sha256 \
196199
"https://github.com/${{ github.repository }}/releases/download/${VERSION}/csp-linux-arm64.sha256"
197200
198201
# Extract checksums

.github/workflows/release-rust.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,16 @@ jobs:
8383
if: ${{ endsWith(matrix.target, '-musl') }}
8484
run: |
8585
ZIG_VERSION=0.13.0
86-
curl -fsSL "https://ziglang.org/download/${ZIG_VERSION}/zig-linux-x86_64-${ZIG_VERSION}.tar.xz" \
87-
| tar -xJ -C "$RUNNER_TEMP"
86+
# Zig signs releases with minisign (not SHA checksums). Verify the
87+
# tarball against the official ziglang.org public key before extracting
88+
# and executing it, so a compromised mirror/MITM can't inject a binary.
89+
ZIG_PUBKEY="RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U"
90+
TARBALL="zig-linux-x86_64-${ZIG_VERSION}.tar.xz"
91+
sudo apt-get update && sudo apt-get install -y minisign
92+
curl -fsSLO "https://ziglang.org/download/${ZIG_VERSION}/${TARBALL}"
93+
curl -fsSLO "https://ziglang.org/download/${ZIG_VERSION}/${TARBALL}.minisig"
94+
minisign -Vm "${TARBALL}" -P "${ZIG_PUBKEY}"
95+
tar -xJf "${TARBALL}" -C "$RUNNER_TEMP"
8896
echo "$RUNNER_TEMP/zig-linux-x86_64-${ZIG_VERSION}" >> "$GITHUB_PATH"
8997
cargo install --locked cargo-zigbuild --version '^0.19'
9098

0 commit comments

Comments
 (0)