Skip to content

Commit 556c424

Browse files
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
1 parent 7e20b23 commit 556c424

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

.github/workflows/pr-size.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ jobs:
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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ on:
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:
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

0 commit comments

Comments
 (0)