From 6a9978b5de38cbce419089921785eff6956cc6de Mon Sep 17 00:00:00 2001 From: Ryan Eberhardt Date: Tue, 24 Mar 2026 22:31:32 -0700 Subject: [PATCH] fix: harden GitHub Actions workflows (zizmor) - Upgrade actions/checkout from v4 to v6.0.2 (SHA-pinned) across all workflows - Add persist-credentials: false to all checkout steps that don't need git credentials (all CI jobs, and release build/publish jobs) - Fix excessive-permissions in release.yml: replace workflow-level contents:write + id-token:write with permissions:{} at workflow level and minimal per-job permissions (contents:write only for sync-and-tag and github-release; contents:read + id-token:write for publish jobs) Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/ci.yml | 16 ++++++++++++---- .github/workflows/release.yml | 24 ++++++++++++++++-------- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a405ba0..4b08183 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false - name: Install Rust uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # stable @@ -41,7 +43,9 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false - name: Install Rust uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # stable @@ -65,7 +69,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false - name: Setup Node.js uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 @@ -112,7 +118,9 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false - name: Install Rust uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # stable diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 73728de..7e1bb5b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,18 +13,18 @@ on: - minor - major -permissions: - contents: write - id-token: write +permissions: {} jobs: sync-and-tag: runs-on: ubuntu-latest + permissions: + contents: write outputs: version: ${{ steps.sync.outputs.VERSION }} steps: - name: Checkout - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Configure Git run: | @@ -117,11 +117,14 @@ jobs: archive: tar.gz build-tool: cross runs-on: ${{ matrix.runner }} + permissions: + contents: read steps: - name: Checkout - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: ref: v${{ needs.sync-and-tag.outputs.version }} + persist-credentials: false - name: Install Rust uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # stable @@ -171,6 +174,8 @@ jobs: github-release: needs: [sync-and-tag, build] runs-on: ubuntu-latest + permissions: + contents: write steps: - name: Download all artifacts uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 @@ -196,9 +201,10 @@ jobs: id-token: write steps: - name: Checkout - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: ref: v${{ needs.sync-and-tag.outputs.version }} + persist-credentials: false - name: Install Rust uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # stable @@ -233,9 +239,10 @@ jobs: id-token: write steps: - name: Checkout - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: ref: v${{ needs.sync-and-tag.outputs.version }} + persist-credentials: false - name: Configure git for HTTPS run: git config --global url."https://github.com/".insteadOf "ssh://git@github.com/" @@ -308,9 +315,10 @@ jobs: id-token: write steps: - name: Checkout - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: ref: v${{ needs.sync-and-tag.outputs.version }} + persist-credentials: false - name: Download all artifacts uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4