Skip to content

Commit dddf964

Browse files
committed
fix(ci): replace pip install with native zizmor binary
Replace `pip install zizmor==1.23.1` with a direct download of the zizmor native binary from GitHub releases. The binary is verified against a SHA-256 checksum before use. This removes the Python/pip dependency entirely. zizmor is a Rust binary that ships standalone builds for all platforms (Linux, macOS, Windows) with no runtime dependencies. Also switches from secrets.GITHUB_TOKEN to github.token to avoid a zizmor secrets-outside-env warning.
1 parent 2976cfb commit dddf964

File tree

1 file changed

+38
-2
lines changed

1 file changed

+38
-2
lines changed

.github/workflows/audit-gha-workflows.yml

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,46 @@ jobs:
1616
with:
1717
persist-credentials: false
1818
- name: Install zizmor
19-
run: pip install zizmor==1.23.1
19+
shell: bash
20+
run: | # zizmor: ignore[github-env]
21+
ZIZMOR_VERSION="1.23.1"
22+
ZIZMOR_DIR="${RUNNER_TEMP:-/tmp}/zizmor-bin"
23+
KERNEL="$(uname -s | cut -d- -f1)"
24+
ARCH="$(uname -m)"
25+
case "${KERNEL}-${ARCH}" in
26+
Linux-x86_64) ASSET="zizmor-x86_64-unknown-linux-gnu.tar.gz" ; EXPECTED_SHA256="67a8df0a14352dd81882e14876653d097b99b0f4f6b6fe798edc0320cff27aff" ;;
27+
Linux-aarch64) ASSET="zizmor-aarch64-unknown-linux-gnu.tar.gz" ; EXPECTED_SHA256="3725d7cd7102e4d70827186389f7d5930b6878232930d0a3eb058d7e5b47e658" ;;
28+
Darwin-x86_64) ASSET="zizmor-x86_64-apple-darwin.tar.gz" ; EXPECTED_SHA256="89d5ed42081dd9d0433a10b7545fac42b35f1f030885c278b9712b32c66f2597" ;;
29+
Darwin-arm64) ASSET="zizmor-aarch64-apple-darwin.tar.gz" ; EXPECTED_SHA256="2632561b974c69f952258c1ab4b7432d5c7f92e555704155c3ac28a2910bd717" ;;
30+
MINGW64_NT-x86_64|MSYS_NT-x86_64) ASSET="zizmor-x86_64-pc-windows-msvc.zip" ; EXPECTED_SHA256="33c2293ff02834720dd7cd8b47348aafb2e95a19bdc993c0ecaca9c804ade92a" ;;
31+
*) echo "Unsupported platform: ${KERNEL}-${ARCH}" >&2; exit 1 ;;
32+
esac
33+
ZIZMOR_BIN="$ZIZMOR_DIR/zizmor"
34+
[[ "$ASSET" == *.zip ]] && ZIZMOR_BIN="$ZIZMOR_DIR/zizmor.exe"
35+
if [ ! -x "$ZIZMOR_BIN" ]; then
36+
mkdir -p "$ZIZMOR_DIR"
37+
DOWNLOAD_URL="https://github.com/woodruffw/zizmor/releases/download/v${ZIZMOR_VERSION}/${ASSET}"
38+
DOWNLOAD_FILE="${ZIZMOR_DIR}/${ASSET}"
39+
curl -fsSL -o "$DOWNLOAD_FILE" "$DOWNLOAD_URL"
40+
ACTUAL_SHA256="$(shasum -a 256 "$DOWNLOAD_FILE" | cut -d' ' -f1)"
41+
if [ "$ACTUAL_SHA256" != "$EXPECTED_SHA256" ]; then
42+
echo "Checksum mismatch for ${ASSET}!" >&2
43+
echo " Expected: ${EXPECTED_SHA256}" >&2
44+
echo " Actual: ${ACTUAL_SHA256}" >&2
45+
exit 1
46+
fi
47+
if [[ "$ASSET" == *.zip ]]; then
48+
unzip -qo "$DOWNLOAD_FILE" -d "$ZIZMOR_DIR"
49+
else
50+
tar xzf "$DOWNLOAD_FILE" -C "$ZIZMOR_DIR"
51+
fi
52+
rm -f "$DOWNLOAD_FILE"
53+
chmod +x "$ZIZMOR_BIN"
54+
fi
55+
echo "$ZIZMOR_DIR" >> "${GITHUB_PATH:-/dev/null}"
2056
- name: Run zizmor
2157
env:
22-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
GITHUB_TOKEN: ${{ github.token }}
2359
run: |
2460
if [ -d .github ]; then
2561
zizmor .github --gh-token "${GITHUB_TOKEN}" --min-severity medium

0 commit comments

Comments
 (0)