Skip to content

Commit 45fcee0

Browse files
committed
Add explicit least-privilege permissions to read-only CI workflows
Seven workflows currently declare no permissions block at all, which leaves GITHUB_TOKEN scope dependent on the repository default. Adding an explicit workflow-level contents: read documents the minimum scope needed and matches GitHub's defense-in-depth guidance. Workflows touched (all are pure CI - build, lint, docs, tests, spell check, version consistency check). None push commits, create releases, or call write APIs: - build.yaml - code-formatting-check.yaml - docs.yaml - local-development-makefile.yaml - test.yaml - typos.yaml - version-checks.yaml Existing workflows that need elevated scopes (cargo-audit, codeql, github-dependency-review, lint) already declare per-job permissions; this PR does not modify those.
1 parent ebc705a commit 45fcee0

7 files changed

Lines changed: 21 additions & 0 deletions

File tree

.github/workflows/build.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
schedule: # Trigger a job on default branch at 4AM PST everyday
1010
- cron: 0 11 * * *
1111

12+
permissions:
13+
contents: read
14+
1215
concurrency:
1316
group: ${{ github.workflow }}-${{ github.event.compare || github.head_ref || github.ref }}
1417
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

.github/workflows/code-formatting-check.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
schedule: # Trigger a job on default branch at 4AM PST everyday
1010
- cron: 0 11 * * *
1111

12+
permissions:
13+
contents: read
14+
1215
concurrency:
1316
group: ${{ github.workflow }}-${{ github.event.compare || github.head_ref || github.ref }}
1417
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

.github/workflows/docs.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
schedule: # Trigger a job on default branch at 4AM PST everyday
1010
- cron: 0 11 * * *
1111

12+
permissions:
13+
contents: read
14+
1215
concurrency:
1316
group: ${{ github.workflow }}-${{ github.event.compare || github.head_ref || github.ref }}
1417
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

.github/workflows/local-development-makefile.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
schedule: # Trigger a job on default branch at 4AM PST everyday
1010
- cron: 0 11 * * *
1111

12+
permissions:
13+
contents: read
14+
1215
concurrency:
1316
group: ${{ github.workflow }}-${{ github.event.compare || github.head_ref || github.ref }}
1417
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

.github/workflows/test.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99

1010
name: Test
1111

12+
permissions:
13+
contents: read
14+
1215
concurrency:
1316
group: ${{ github.workflow }}-${{ github.event.compare || github.head_ref || github.ref }}
1417
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

.github/workflows/typos.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99

1010
name: Typos
1111

12+
permissions:
13+
contents: read
14+
1215
concurrency:
1316
group: ${{ github.workflow }}-${{ github.event.compare || github.head_ref || github.ref }}
1417
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

.github/workflows/version-checks.yaml

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

10+
permissions:
11+
contents: read
12+
1013
concurrency:
1114
group: ${{ github.workflow }}-${{ github.event.compare || github.head_ref || github.ref }}
1215
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

0 commit comments

Comments
 (0)