Skip to content

Commit 39bb5c3

Browse files
[SECURITY] minor refactor of permissions to move them to jobs
1 parent 84a4d60 commit 39bb5c3

1 file changed

Lines changed: 37 additions & 5 deletions

File tree

.github/workflows/Tests.yml

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,19 @@ on:
1515
- reopened
1616
- ready_for_review
1717

18-
# Declare default permissions as read only.
19-
permissions:
20-
contents: read # for actions/checkout to fetch code
21-
actions: read
22-
pull-requests: read
18+
# Declare default permissions as none.
19+
permissions: {}
2320

2421

2522
jobs:
2623
BUILD:
2724
if: github.repository == 'reactive-firewall/python-repo'
2825
runs-on: ubuntu-latest
26+
permissions:
27+
contents: read # for actions/checkout to fetch code
28+
actions: read
29+
pull-requests: read
30+
statuses: write
2931
defaults:
3032
run:
3133
shell: bash
@@ -54,6 +56,11 @@ jobs:
5456
if: ${{ !cancelled() }}
5557
needs: BUILD
5658
runs-on: ubuntu-latest
59+
permissions:
60+
contents: read # for actions/checkout to fetch code
61+
actions: read
62+
pull-requests: read
63+
statuses: write
5764
defaults:
5865
run:
5966
shell: bash
@@ -133,6 +140,11 @@ jobs:
133140
if: ${{ !cancelled() }}
134141
needs: BUILD
135142
runs-on: ubuntu-latest
143+
permissions:
144+
contents: read # for actions/checkout to fetch code
145+
actions: read
146+
pull-requests: read
147+
statuses: write
136148
defaults:
137149
run:
138150
shell: bash
@@ -177,6 +189,11 @@ jobs:
177189
if: ${{ success() }}
178190
needs: [BUILD, MATS]
179191
runs-on: ${{ matrix.os }}
192+
permissions:
193+
contents: read # for actions/checkout to fetch code
194+
actions: read
195+
pull-requests: read
196+
statuses: write
180197
defaults:
181198
run:
182199
shell: bash
@@ -263,6 +280,11 @@ jobs:
263280
if: ${{ success() }}
264281
needs: [BUILD, MATS]
265282
runs-on: ubuntu-latest
283+
permissions:
284+
contents: read # for actions/checkout to fetch code
285+
actions: read
286+
pull-requests: read
287+
statuses: write
266288
timeout-minutes: 10
267289

268290
env:
@@ -298,6 +320,11 @@ jobs:
298320
if: ${{ success() }}
299321
needs: [MATS, COVERAGE]
300322
runs-on: ${{ matrix.os }}
323+
permissions:
324+
contents: read # for actions/checkout to fetch code
325+
actions: read
326+
pull-requests: read
327+
statuses: write
301328
timeout-minutes: 10
302329
strategy:
303330
matrix:
@@ -380,6 +407,11 @@ jobs:
380407
if: ${{ success() }}
381408
needs: [MATS, STYLE, COVERAGE, INTEGRATION]
382409
runs-on: ubuntu-latest
410+
permissions:
411+
contents: read # for actions/checkout to fetch code
412+
actions: read
413+
pull-requests: read
414+
statuses: write
383415
timeout-minutes: 30
384416

385417
env:

0 commit comments

Comments
 (0)