Skip to content

Commit d3224a8

Browse files
committed
ci: declare workflow-level contents: read on 12 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 09a7cbe commit d3224a8

12 files changed

Lines changed: 36 additions & 0 deletions

.github/workflows/build-presets.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ concurrency:
1212
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }}
1313
cancel-in-progress: true
1414

15+
permissions:
16+
contents: read
17+
1518
jobs:
1619
apple:
1720
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main

.github/workflows/cherry-pick.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
repository_dispatch:
55
types: [try-cherry-pick]
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
cherry-pick:
912
name: cherry-pick-pr-${{ github.event.client_payload.pr_num }}

.github/workflows/ghstack_land.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
branches:
66
- 'gh/*/[0-9]+/base'
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
ghstack_merge_to_main:
1013
name: Try to create a PR with ghstack /orig branch

.github/workflows/metal.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ concurrency:
2020
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }}
2121
cancel-in-progress: true
2222

23+
permissions:
24+
contents: read
25+
2326
jobs:
2427
test-metal-builds:
2528
name: test-executorch-metal-build

.github/workflows/test-backend-arm.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ concurrency:
1616
group: ${{ github.workflow }}--${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
1717
cancel-in-progress: true
1818

19+
permissions:
20+
contents: read
21+
1922
jobs:
2023
test-arm:
2124
uses: ./.github/workflows/_test_backend.yml

.github/workflows/test-backend-coreml.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ concurrency:
1616
group: ${{ github.workflow }}--${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
1717
cancel-in-progress: true
1818

19+
permissions:
20+
contents: read
21+
1922
jobs:
2023
test-coreml:
2124
uses: ./.github/workflows/_test_backend.yml

.github/workflows/test-backend-openvino.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ concurrency:
1818
group: ${{ github.workflow }}--${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
1919
cancel-in-progress: true
2020

21+
permissions:
22+
contents: read
23+
2124
jobs:
2225
test-openvino:
2326
uses: ./.github/workflows/_test_backend.yml

.github/workflows/test-backend-qnn.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ concurrency:
1616
group: ${{ github.workflow }}--${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
1717
cancel-in-progress: true
1818

19+
permissions:
20+
contents: read
21+
1922
jobs:
2023
test-qnn:
2124
uses: ./.github/workflows/_test_backend.yml

.github/workflows/test-backend-vulkan.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ concurrency:
1616
group: ${{ github.workflow }}--${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
1717
cancel-in-progress: true
1818

19+
permissions:
20+
contents: read
21+
1922
jobs:
2023
test-vulkan:
2124
uses: ./.github/workflows/_test_backend.yml

.github/workflows/test-backend-xnnpack.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ concurrency:
1616
group: ${{ github.workflow }}--${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}
1717
cancel-in-progress: true
1818

19+
permissions:
20+
contents: read
21+
1922
jobs:
2023
test-xnnpack:
2124
uses: ./.github/workflows/_test_backend.yml

0 commit comments

Comments
 (0)