History

Harden GitHub workflow permissions

- Restrict release workflow defaults to read-only access - Grant `id-token` only to the publish job - Document safe handling for `pull_request_target` in PR size checks

Julius Marminge committed 6 months agov0.0.24-nightly.20260513.277

Commit 556c4241 parent 7e20b232 files · +8 −2Browse files

Showing the changes to .github (2 of 2 files). Show all

Unified · Split

2 files
  1. .github/workflows/pr-size.yml +3 −0
  2. .github/workflows/release.yml +5 −2
.github/workflows/pr-size.yml+3−0
@@ -124,6 +124,9 @@ jobs: · 123 unmodified lines
124124 group: pr-size-${{ github.event.pull_request.number }}
125125 cancel-in-progress: true
126126 steps:
127+ # This pull_request_target job may fetch untrusted PR commits only as passive
128+ # git data. Do not add dependency installs, build/test scripts, or cache
129+ # actions here; use pull_request plus workflow_run for that pattern instead.
127130 - name: Checkout base repository
128131 uses: actions/checkout@v4
129132 with:
.github/workflows/release.yml+5−2
@@ -23,8 +23,8 @@ on: · 22 unmodified lines
2323 type: string
2424
2525 permissions:
26− contents: write
27− id-token: write
26+ contents: read
27+ id-token: none
2828
2929 jobs:
3030 check_changes:
@@ -420,6 +420,9 @@ jobs: · 389 unmodified lines
420420 if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.build.result == 'success' }}
421421 runs-on: ubuntu-24.04 # blacksmith-8vcpu-ubuntu-2404
422422 timeout-minutes: 10
423+ permissions:
424+ contents: read
425+ id-token: write
423426 steps:
424427 - name: Checkout
425428 uses: actions/checkout@v6