Skip to content

Commit 42a909e

Browse files
authored
chore(ci): rescope permissions according to principle of least privilege (#323)
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 6bfac85 commit 42a909e

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 2 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
push:
@@ -21,6 +20,8 @@ jobs:
2120
name: test ${{ matrix.rust }} ${{ matrix.flags }} (${{ matrix.os }})
2221
runs-on: ${{ matrix.os }}
2322
timeout-minutes: 30
23+
permissions:
24+
contents: read
2425
strategy:
2526
fail-fast: false
2627
matrix:
@@ -52,6 +53,8 @@ jobs:
5253
doctest:
5354
runs-on: ubuntu-latest
5455
timeout-minutes: 30
56+
permissions:
57+
contents: read
5558
steps:
5659
- uses: actions/checkout@v5
5760
with:
@@ -67,6 +70,8 @@ jobs:
6770
feature-checks:
6871
runs-on: ubuntu-latest
6972
timeout-minutes: 30
73+
permissions:
74+
contents: read
7075
steps:
7176
- uses: actions/checkout@v5
7277
with:
@@ -86,6 +91,8 @@ jobs:
8691
clippy:
8792
runs-on: ubuntu-latest
8893
timeout-minutes: 30
94+
permissions:
95+
contents: read
8996
steps:
9097
- uses: actions/checkout@v5
9198
with:
@@ -104,6 +111,8 @@ jobs:
104111
docs:
105112
runs-on: ubuntu-latest
106113
timeout-minutes: 30
114+
permissions:
115+
contents: read
107116
steps:
108117
- uses: actions/checkout@v5
109118
with:
@@ -121,6 +130,8 @@ jobs:
121130
fmt:
122131
runs-on: ubuntu-latest
123132
timeout-minutes: 30
133+
permissions:
134+
contents: read
124135
steps:
125136
- uses: actions/checkout@v5
126137
with:
@@ -133,6 +144,8 @@ jobs:
133144

134145
deny:
135146
uses: ithacaxyz/ci/.github/workflows/deny.yml@9c8d0dc20e7ad02455d3fdab2378a05f29907630 # main
147+
permissions:
148+
contents: read
136149

137150
ci-success:
138151
runs-on: ubuntu-latest

.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

0 commit comments

Comments
 (0)