Skip to content

Commit 301cfcc

Browse files
committed
Declare permissions
Repositories can be configured with Default access (restricted) https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token Best practice says that workflows should declare the minimal permissions they require. Without declaring permissions, paranoid forks fail miserably.
1 parent 73d0b7e commit 301cfcc

29 files changed

+106
-3
lines changed

.github/workflows/check-change-note.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Check change note
22

3+
permissions:
4+
pull-requests: read
5+
36
on:
47
pull_request_target:
58
types: [labeled, unlabeled, opened, synchronize, reopened, ready_for_review]

.github/workflows/check-implicit-this.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
- main
1010
- "rc/*"
1111

12+
permissions:
13+
contents: read
14+
1215
jobs:
1316
check:
1417
runs-on: ubuntu-latest

.github/workflows/check-qldoc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ on:
1010
- main
1111
- "rc/*"
1212

13+
permissions:
14+
contents: read
15+
1316
jobs:
1417
qldoc:
1518
runs-on: ubuntu-latest

.github/workflows/check-query-ids.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111
- "rc/*"
1212
workflow_dispatch:
1313

14+
permissions:
15+
contents: read
16+
1417
jobs:
1518
check:
1619
name: Check query IDs

.github/workflows/close-stale.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
schedule:
66
- cron: "30 1 * * *"
77

8+
permissions:
9+
issues: write
10+
811
jobs:
912
stale:
1013
if: github.repository == 'github/codeql'

.github/workflows/compile-queries.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
- "codeql-cli-*"
99
pull_request:
1010

11+
permissions:
12+
contents: read
13+
1114
jobs:
1215
compile-queries:
1316
runs-on: ubuntu-latest-xl

.github/workflows/csharp-qltest.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ defaults:
2525
run:
2626
working-directory: csharp
2727

28+
permissions:
29+
contents: read
30+
security-events: read
31+
2832
jobs:
2933
qlupgrade:
3034
runs-on: ubuntu-latest
@@ -51,6 +55,9 @@ jobs:
5155
fail-fast: false
5256
matrix:
5357
slice: ["1/2", "2/2"]
58+
permissions:
59+
contents: read
60+
security-events: write
5461
steps:
5562
- uses: actions/checkout@v4
5663
- uses: ./csharp/actions/create-extractor-pack

.github/workflows/csv-coverage-metrics.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ on:
1414
- ".github/workflows/csv-coverage-metrics.yml"
1515
- ".github/actions/fetch-codeql/action.yml"
1616

17+
permissions:
18+
contents: read
19+
security-events: write
20+
1721
jobs:
1822
publish-java:
1923
runs-on: ubuntu-latest

.github/workflows/csv-coverage-pr-artifacts.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ on:
1919
- main
2020
- "rc/*"
2121

22+
permissions:
23+
contents: read
24+
pull-requests: read
25+
2226
jobs:
2327
generate:
2428
name: Generate framework coverage artifacts

.github/workflows/csv-coverage-pr-comment.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
types:
77
- completed
88

9+
permissions:
10+
contents: read
11+
pull-requests: write
12+
913
jobs:
1014
check:
1115
name: Check framework coverage differences and comment

0 commit comments

Comments
 (0)