Skip to content

Commit 405e464

Browse files
authored
Merge pull request #4679 from ornladios/copilot/restrict-workflow-token-permissions
Restrict workflow token permissions to minimal required access
2 parents 9e9ab97 + fbdbed9 commit 405e464

File tree

4 files changed

+44
-2
lines changed

4 files changed

+44
-2
lines changed

.github/workflows/everything.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ on:
3636
- master
3737
- release*
3838

39+
permissions:
40+
contents: read
41+
3942
concurrency:
4043
group: ${{ github.head_ref || github.run_id }}
4144
cancel-in-progress: true
@@ -113,6 +116,9 @@ jobs:
113116
if: needs.git_checks.outputs.num_code_changes > 0
114117

115118
runs-on: ubuntu-22.04
119+
permissions:
120+
contents: read
121+
actions: write # for cache save
116122
container:
117123
image: ghcr.io/ornladios/adios2:ci-spack-${{ matrix.os }}-${{ matrix.compiler }}
118124
options: --shm-size=1g
@@ -211,6 +217,9 @@ jobs:
211217
if: needs.git_checks.outputs.num_code_changes > 0
212218

213219
runs-on: ubuntu-latest
220+
permissions:
221+
contents: read
222+
actions: write # for cache save
214223
container:
215224
image: ghcr.io/ornladios/adios2:ci-el8-${{ matrix.compiler }}
216225
options: --shm-size=1g
@@ -275,6 +284,9 @@ jobs:
275284
if: needs.git_checks.outputs.num_code_changes > 0
276285

277286
runs-on: ${{ matrix.image }}
287+
permissions:
288+
contents: read
289+
actions: write # for cache save
278290
env:
279291
# Only way to source a file in a non interactive/non login shell.
280292
BASH_ENV: "/Users/runner/.bash_profile"
@@ -414,6 +426,9 @@ jobs:
414426
if: needs.git_checks.outputs.num_code_changes > 0
415427

416428
runs-on: ubuntu-latest
429+
permissions:
430+
contents: read
431+
actions: write # for upload-artifact
417432
strategy:
418433
fail-fast: false
419434
matrix:
@@ -479,6 +494,9 @@ jobs:
479494
if: needs.git_checks.outputs.num_code_changes > 0
480495

481496
runs-on: ubuntu-latest
497+
permissions:
498+
contents: read
499+
actions: read # for download-artifact
482500
strategy:
483501
fail-fast: false
484502
matrix:
@@ -543,7 +561,7 @@ jobs:
543561
GH_YML_MATRIX_COMPILER: gcc8
544562
GH_YML_MATRIX_PARALLEL: serial
545563
permissions:
546-
actions: read
564+
actions: write # for cache save and upload-artifact
547565
contents: read
548566
security-events: write
549567

.github/workflows/external.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@ on:
33
push:
44
pull_request_target:
55

6-
permissions: write-all
6+
permissions:
7+
contents: read
8+
statuses: write
79

810
jobs:
911
generate_statuses:
1012
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
statuses: write
1116
steps:
1217
- uses: actions/checkout@v4
1318
- uses: Kitware/cdash-status@release

.github/workflows/pypackaging.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ jobs:
3232
make_sdist:
3333
name: Make SDist
3434
runs-on: ubuntu-latest
35+
permissions:
36+
contents: read
37+
actions: write # for upload-artifact
3538
steps:
3639
- uses: actions/checkout@v4
3740
with:
@@ -51,6 +54,9 @@ jobs:
5154
build_wheels:
5255
name: Wheel on ${{ matrix.os }}
5356
runs-on: ${{ matrix.os }}
57+
permissions:
58+
contents: read
59+
actions: write # for upload-artifact
5460
strategy:
5561
fail-fast: false
5662
matrix:
@@ -79,6 +85,8 @@ jobs:
7985
needs: [build_wheels, make_sdist]
8086
environment: pypi
8187
permissions:
88+
contents: read
89+
actions: read # for download-artifact
8290
id-token: write
8391
runs-on: ubuntu-latest
8492
if: |
@@ -100,6 +108,8 @@ jobs:
100108
needs: [build_wheels, make_sdist]
101109
environment: testpypi
102110
permissions:
111+
contents: read
112+
actions: read # for download-artifact
103113
id-token: write
104114
runs-on: ubuntu-latest
105115
if: github.event_name == 'workflow_dispatch' && github.event.inputs.pypiServer == 'testpypi'

.github/workflows/stale.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,18 @@ on:
44
- cron: '30 2 * * *'
55
workflow_dispatch:
66

7+
permissions:
8+
contents: read
9+
issues: write
10+
pull-requests: write
11+
712
jobs:
813
stale:
914
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
issues: write
18+
pull-requests: write
1019
steps:
1120
- uses: actions/stale@v9
1221
with:

0 commit comments

Comments
 (0)