Skip to content

Commit 60e3bc2

Browse files
ci: set least-privilege GITHUB_TOKEN permissions (#7)
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 fa79b49 commit 60e3bc2

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
pull_request:
88
branches: [master]
99

10+
permissions:
11+
contents: read
12+
1013
jobs:
1114
lint:
1215
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)