Skip to content

Commit 7044ad7

Browse files
committed
ci: Move elevated permissions to run level
1 parent b94c025 commit 7044ad7

10 files changed

+41
-17
lines changed

.github/workflows/blocked-reminder.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
# others on Fri.
77
- cron: '0 15 * * 1,4'
88

9+
permissions:
10+
issues: read # for actions/github-script to query issues
11+
912
jobs:
1013
issue-list:
1114
runs-on: ubuntu-latest

.github/workflows/build-and-publish.yaml

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@ on:
66
- main
77

88
permissions:
9-
id-token: write # needed for keyless signing
10-
packages: write # needed for ghcr access
9+
contents: read # for actions/checkout to fetch code
1110

1211
env:
1312
CONTROLLER: ${{ github.event.repository.name }}
1413

1514
jobs:
1615
test:
1716
runs-on: ubuntu-latest
17+
permissions:
18+
id-token: write # needed for keyless signing
19+
packages: write # needed for ghcr access
1820
steps:
1921
- name: Checkout
2022
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0

.github/workflows/docs.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
- '.github/workflows/docs.yaml'
99
- 'mkdocs.yml'
1010

11+
permissions:
12+
contents: read # for actions/checkout to fetch code
13+
1114
jobs:
1215
publish:
1316
runs-on: ubuntu-latest

.github/workflows/helm-release.yaml

+6-4
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@ on:
33
workflow_dispatch:
44

55
permissions:
6-
contents: write # needed to write releases
7-
id-token: write # needed for keyless signing
8-
packages: write # needed for ghcr access
6+
contents: read # for actions/checkout to fetch code
97

108
jobs:
119
publish:
1210
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write # needed to write releases
13+
id-token: write # needed for keyless signing
14+
packages: write # needed for ghcr access
1315
steps:
1416
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
15-
- name: Publish Helm chart
17+
- name: Publish Helm chart in GitHub Pages
1618
uses: stefanprodan/helm-gh-pages@0ad2bb377311d61ac04ad9eb6f252fb68e207260 # v1.7.0
1719
with:
1820
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/ossf.yaml

+2-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@ jobs:
1515
name: Scorecard analysis
1616
runs-on: ubuntu-latest
1717
permissions:
18-
# Needed if using Code scanning alerts
19-
security-events: write
20-
# Needed for GitHub OIDC token if publish_results is true
21-
id-token: write
18+
security-events: write # needed if using Code scanning alerts
19+
id-token: write # needed for GitHub OIDC token if publish_results is true
2220

2321
steps:
2422
- name: "Checkout code"

.github/workflows/release-runners.yaml

+9-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ on:
1313
required: true
1414

1515
permissions:
16-
contents: write # needed to write releases
17-
id-token: write # needed for keyless signing
18-
packages: write # needed for ghcr access
16+
contents: read # for actions/checkout to fetch code
1917

2018
env:
2119
VERSION: ${{ github.event.inputs.version }}
@@ -24,6 +22,10 @@ env:
2422
jobs:
2523
release-base:
2624
runs-on: ubuntu-latest
25+
permissions:
26+
contents: write # needed to write releases
27+
id-token: write # needed for keyless signing
28+
packages: write # needed for ghcr access
2729
steps:
2830
- name: Check out
2931
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
@@ -64,6 +66,10 @@ jobs:
6466
release-mpl:
6567
needs: release-base
6668
runs-on: ubuntu-latest
69+
permissions:
70+
contents: write # needed to write releases
71+
id-token: write # needed for keyless signing
72+
packages: write # needed for ghcr access
6773
strategy:
6874
matrix:
6975
tf_version: [1.0.11, 1.1.9, 1.2.9, 1.3.9, 1.4.6, 1.5.5]

.github/workflows/release.yaml

+5-3
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,18 @@ on:
1111
required: true
1212

1313
permissions:
14-
contents: write # needed to write releases
15-
id-token: write # needed for keyless signing
16-
packages: write # needed for ghcr access
14+
contents: read # for actions/checkout to fetch code
1715

1816
env:
1917
CONTROLLER: ${{ github.event.repository.name }}
2018

2119
jobs:
2220
build-push:
2321
runs-on: ubuntu-latest
22+
permissions:
23+
contents: write # needed to write releases
24+
id-token: write # needed for keyless signing
25+
packages: write # needed for ghcr access
2426
steps:
2527
- name: Check out
2628
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0

.github/workflows/scan.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ on:
99

1010
permissions:
1111
contents: read # for actions/checkout to fetch code
12-
security-events: write # for codeQL to write security events
1312

1413
jobs:
1514
fossa:
@@ -27,6 +26,8 @@ jobs:
2726
codeql:
2827
name: CodeQL
2928
runs-on: ubuntu-latest
29+
permissions:
30+
security-events: write # for codeQL to write security events
3031
steps:
3132
- name: Checkout repository
3233
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0

.github/workflows/targeted-test.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
pattern:
55
required: true
66
type: string
7+
8+
permissions:
9+
contents: read # for actions/checkout to fetch code
10+
711
jobs:
812
targeted-test:
913
runs-on: ubuntu-latest

.github/workflows/test.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ on:
1414
branches:
1515
- main
1616

17+
permissions:
18+
contents: read # for actions/checkout to fetch code
19+
1720
jobs:
1821
test-1x-2x:
1922
name: "Controller Tests: 10->29"

0 commit comments

Comments
 (0)