Skip to content

Commit 83f609a

Browse files
committed
Add explicit permissions to CI workflow
- Added workflow-level default permissions (contents: read) - Added job-level permissions for all jobs following least privilege: - build: contents:read, actions:write, security-events:write - upload-event-file: contents:read, actions:write - build-for-e2e-test: contents:read, actions:write - e2e-test: contents:read, actions:write, checks:write - publish: contents:write Fixes #1457
1 parent aff4219 commit 83f609a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

.github/workflows/CI.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,15 @@ on:
1111
- cron: "0 7 * * *"
1212
workflow_dispatch:
1313

14+
permissions:
15+
contents: read
16+
1417
jobs:
1518
build:
19+
permissions:
20+
contents: read
21+
actions: write
22+
security-events: write
1623
strategy:
1724
fail-fast: false
1825
matrix:
@@ -85,6 +92,9 @@ jobs:
8592
if: matrix.runner-os == 'ubuntu-latest'
8693

8794
upload-event-file:
95+
permissions:
96+
contents: read
97+
actions: write
8898
runs-on: ubuntu-latest
8999
steps:
90100
# This is used by the subsequent publish-test-results.yaml
@@ -95,6 +105,9 @@ jobs:
95105
path: ${{ github.event_path }}
96106

97107
build-for-e2e-test:
108+
permissions:
109+
contents: read
110+
actions: write
98111
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login == 'github'
99112
strategy:
100113
fail-fast: false
@@ -140,6 +153,10 @@ jobs:
140153
dist/win-x64/gei-windows-amd64.exe
141154
142155
e2e-test:
156+
permissions:
157+
contents: read
158+
actions: write
159+
checks: write
143160
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login == 'github'
144161
needs: [build-for-e2e-test]
145162
strategy:
@@ -276,6 +293,8 @@ jobs:
276293
shell: pwsh
277294

278295
publish:
296+
permissions:
297+
contents: write
279298
runs-on: ubuntu-latest
280299
if: startsWith(github.ref, 'refs/tags/v')
281300
needs: [build, e2e-test]

0 commit comments

Comments
 (0)