Skip to content

Commit 195f747

Browse files
ci: set least-privilege GITHUB_TOKEN permissions (#104)
Add top-level `permissions: contents: read` to every workflow. Without it, jobs inherit the repo-default token scope (often read-write), so a malicious dependency executing during install/build/test on a push to the default branch would hold a write-capable token. Read-only by default denies that; the publish job keeps its own job-level `id-token: write` block (job-level permissions override the top-level default), so trusted-publishing is unaffected. Complements the SHA-pinning: pinning stops untrusted code from running; this limits what it can do if it runs anyway. Fork-PR tokens are already forced read-only by GitHub; this closes the push-triggered path. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent c87c5b8 commit 195f747

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ on:
1313
branches: [ master ]
1414
workflow_dispatch:
1515

16+
permissions:
17+
contents: read
18+
1619
jobs:
1720
lint:
1821
runs-on: ubuntu-latest

.github/workflows/coverage.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ on:
1010
branches: [ master ]
1111
workflow_dispatch:
1212

13+
permissions:
14+
contents: read
15+
1316
jobs:
1417
codecov:
1518

0 commit comments

Comments
 (0)