Skip to content

Commit 975c10c

Browse files
authored
chore(ci): rescope permissions according to principle of least privilege (#731)
By assigning ``` permissions: {} ``` we disable all permissions by default we then grant it on a per-job basis to exactly what is strictly required
1 parent 0e01ca7 commit 975c10c

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
name: CI
22

3-
permissions:
4-
contents: read
3+
permissions: {}
54

65
on:
76
workflow_dispatch:
@@ -15,6 +14,8 @@ jobs:
1514
name: build +${{ matrix.toolchain }} ${{ matrix.flags }}
1615
runs-on: ubuntu-latest
1716
timeout-minutes: 10
17+
permissions:
18+
contents: read
1819
strategy:
1920
fail-fast: false
2021
matrix:
@@ -51,6 +52,8 @@ jobs:
5152
test:
5253
runs-on: ubuntu-latest
5354
timeout-minutes: 10
55+
permissions:
56+
contents: read
5457
strategy:
5558
fail-fast: false
5659
matrix:
@@ -73,6 +76,8 @@ jobs:
7376
fmt:
7477
runs-on: ubuntu-latest
7578
timeout-minutes: 10
79+
permissions:
80+
contents: read
7681
steps:
7782
- uses: actions/checkout@v5
7883
with:
@@ -84,6 +89,8 @@ jobs:
8489
typos:
8590
runs-on: ubuntu-latest
8691
timeout-minutes: 10
92+
permissions:
93+
contents: read
8794
steps:
8895
- uses: actions/checkout@v5
8996
with:
@@ -93,7 +100,6 @@ jobs:
93100
ci-success:
94101
runs-on: ubuntu-latest
95102
if: always()
96-
permissions: {}
97103
needs:
98104
- build
99105
- test

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
name: CodeQL
22

3-
permissions:
4-
contents: read
3+
permissions: {}
54

65
on:
76
push:
@@ -23,6 +22,7 @@ jobs:
2322
permissions:
2423
security-events: write
2524
actions: read
25+
contents: read
2626

2727
strategy:
2828
fail-fast: false

.github/workflows/sync.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
name: Sync Release Branch
22

3-
permissions:
4-
contents: read
3+
permissions: {}
54

65
on:
76
release:

0 commit comments

Comments
 (0)