Skip to content

Commit dd9748a

Browse files
Limit privilege escalation and token theft in workflows
https://lists.openssf-vuln.org/g/siren/message/6 - Added explicit permissions blocks to restrict access (mostly contents: read, id-token: write). - Limited event triggers to only trusted branches - Added workflow_dispatch where missing.
1 parent ca53f8e commit dd9748a

File tree

8 files changed

+30
-2
lines changed

8 files changed

+30
-2
lines changed

.github/workflows/check_changelogs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ name: Check changelog entries
22

33
on:
44
pull_request:
5+
workflow_dispatch:
6+
7+
permissions:
8+
contents: read
59

610
jobs:
711
check-changelogs:

.github/workflows/gpu_test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ on:
1313
env:
1414
LD_LIBRARY_PATH: /usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64
1515

16+
permissions:
17+
contents: read
18+
1619
concurrency:
1720
group: ${{ github.workflow }}-${{ github.ref }}
1821
cancel-in-progress: true

.github/workflows/hypothesis.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
- cron: "0 0 * * *" # Daily “At 00:00” UTC
1010
workflow_dispatch: # allows you to trigger manually
1111

12+
permissions:
13+
contents: read
14+
1215
env:
1316
FORCE_COLOR: 3
1417

.github/workflows/lint.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
branches: [main, 3.1.x]
88
workflow_dispatch:
99

10+
permissions:
11+
contents: read
12+
1013
concurrency:
1114
group: ${{ github.workflow }}-${{ github.ref }}
1215
cancel-in-progress: true

.github/workflows/needs_release_notes.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: "Pull Request Labeler"
22

33
on:
44
- pull_request_target
5+
types: [opened, reopened, synchronize]
56

67
jobs:
78
labeler:

.github/workflows/nightly_wheels.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
- cron: '0 2 * * *'
77
workflow_dispatch:
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
build_and_upload_nightly:
1114
name: Build and upload nightly wheels

.github/workflows/releases.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
name: Wheels
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
412

513
jobs:
614

.github/workflows/test.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ on:
1010
branches: [ main, 3.1.x ]
1111
workflow_dispatch:
1212

13+
permissions:
14+
contents: read
15+
1316
concurrency:
1417
group: ${{ github.workflow }}-${{ github.ref }}
1518
cancel-in-progress: true
@@ -150,4 +153,4 @@ jobs:
150153
contains(needs.*.result, 'cancelled')
151154
run: exit 1
152155
- name: Success
153-
run: echo Success!
156+
run: echo Success!

0 commit comments

Comments
 (0)