Skip to content

Commit 348794e

Browse files
arpitjain099ytmimi
authored andcommitted
ci: declare workflow-level contents: read on 6 workflows
Pins the default GITHUB_TOKEN to contents: read on the workflows in .github/workflows/ that don't call a GitHub API beyond the initial checkout. The other workflows in this directory are left implicit because they need write scopes that a maintainer is better placed to declare. Motivation: CVE-2025-30066 (March 2025 tj-actions/changed-files compromise) exfiltrated GITHUB_TOKEN from workflow logs. Per-workflow caps bound runtime authority irrespective of repo or org default, give drift protection if the default ever widens, and are credited per-file by the OpenSSF Scorecard Token-Permissions check. YAML validated locally with yaml.safe_load. Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
1 parent 35716e5 commit 348794e

6 files changed

Lines changed: 18 additions & 0 deletions

File tree

.github/workflows/check_diff.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ on:
3333
description: 'Optional comma separated list of rustfmt config options to pass when running the feature branch'
3434
required: false
3535

36+
permissions:
37+
contents: read
38+
3639
jobs:
3740
diff_check:
3841
runs-on: ubuntu-latest

.github/workflows/integration.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
- main
66
pull_request:
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
integration-tests:
1013
runs-on: ubuntu-latest

.github/workflows/linux.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
- main
66
pull_request:
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
test:
1013
runs-on: ubuntu-latest

.github/workflows/mac.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
- main
66
pull_request:
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
test:
1013
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/virtual-environments-for-github-hosted-runners#supported-runners-and-hardware-resources

.github/workflows/rustdoc_check.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
- main
66
pull_request:
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
rustdoc_check:
1013
runs-on: ubuntu-latest

.github/workflows/windows.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
- main
66
pull_request:
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
test:
1013
runs-on: windows-latest

0 commit comments

Comments
 (0)