Skip to content

Commit d84b2b4

Browse files
Add least-privilege permissions to workflows missing them (#1074)
Six workflows declared no permissions block and fell back to the repository default GITHUB_TOKEN scope, which can be broader than the job needs. Declare an explicit block on each so the token is scoped to the work the job actually does. The base installer gets contents: write to tag and publish its Release, the commit-message check gets contents: read plus pull-requests: write for its sticky comment, and link-check, openspec-validate, check-whitespace, and stray-docs get contents: read only. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent ed3ed8f commit d84b2b4

6 files changed

Lines changed: 23 additions & 0 deletions

File tree

.github/workflows/CommitMessage.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ on:
33
pull_request:
44
workflow_call:
55

6+
permissions:
7+
contents: read
8+
# pull-requests: write lets the sticky-comment step post and clear the
9+
# commit-message feedback comment on the PR.
10+
pull-requests: write
11+
612
jobs:
713
gitlint:
814
name: Check commit messages

.github/workflows/base-installer-cd.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ concurrency:
4343
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
4444
cancel-in-progress: true
4545

46+
permissions:
47+
# contents: write is required to tag the repo and publish the GitHub Release
48+
# (softprops/action-gh-release); no other GITHUB_TOKEN write is needed here.
49+
contents: write
50+
4651
jobs:
4752
debug_build_and_test:
4853
env:

.github/workflows/check-whitespace.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ concurrency:
99
group: ${{ github.workflow }}-${{ github.ref }}
1010
cancel-in-progress: true
1111

12+
permissions:
13+
contents: read
14+
1215
jobs:
1316
check-whitespace:
1417
runs-on: ubuntu-latest

.github/workflows/link-check.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
pull_request:
55
workflow_dispatch:
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
lychee:
912
runs-on: ubuntu-latest

.github/workflows/openspec-validate.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
- 'openspec/**'
77
- '**/AGENTS.md'
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
validate-refs:
1114
runs-on: windows-2022

.github/workflows/stray-docs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ concurrency:
88
group: ${{ github.workflow }}-${{ github.ref }}
99
cancel-in-progress: true
1010

11+
permissions:
12+
contents: read
13+
1114
jobs:
1215
stray-docs:
1316
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)