Skip to content

Commit fcc3527

Browse files
authored
ci: fix release job permissions (#831)
* ci: fix release build job permissions The release build jobs need 'contents: write' permissions to be able to update the release. * ci: get rid of all 'secrets: inherit' While convenient it does not follow the rule of minimal privileges * ci: specify secrets in reusable workflows --------- Signed-off-by: Ron <[email protected]>
1 parent fd545f0 commit fcc3527

File tree

4 files changed

+37
-4
lines changed

4 files changed

+37
-4
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ permissions: {}
1616
jobs:
1717
build-push-test:
1818
uses: ./.github/workflows/wc-build-push-test.yml
19-
secrets: inherit
19+
secrets:
20+
TEST_GITHUB_TOKEN: ${{ secrets.TEST_GITHUB_TOKEN }}
21+
TEST_GITHUB_USER: ${{ secrets.TEST_GITHUB_USER }}
22+
TEST_GITHUB_PASSWORD: ${{ secrets.TEST_GITHUB_PASSWORD }}
23+
TEST_GITHUB_TOTP_SECRET: ${{ secrets.TEST_GITHUB_TOTP_SECRET }}
2024
permissions:
2125
actions: read
2226
attestations: write

.github/workflows/release-build.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ permissions: {}
1717
jobs:
1818
build-push-test:
1919
uses: ./.github/workflows/wc-build-push-test.yml
20-
secrets: inherit
20+
secrets:
21+
TEST_GITHUB_TOKEN: ${{ secrets.TEST_GITHUB_TOKEN }}
22+
TEST_GITHUB_USER: ${{ secrets.TEST_GITHUB_USER }}
23+
TEST_GITHUB_PASSWORD: ${{ secrets.TEST_GITHUB_PASSWORD }}
24+
TEST_GITHUB_TOTP_SECRET: ${{ secrets.TEST_GITHUB_TOTP_SECRET }}
2125
permissions:
2226
actions: read
2327
attestations: write
@@ -31,6 +35,8 @@ jobs:
3135
enable-cache: false
3236
apply-release-notes-template:
3337
runs-on: ubuntu-latest
38+
permissions:
39+
contents: write
3440
steps:
3541
- uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
3642
with:
@@ -54,6 +60,8 @@ jobs:
5460
matrix:
5561
flavor: [cpp, rust]
5662
runs-on: ubuntu-latest
63+
permissions:
64+
contents: write
5765
needs: [build-push-test, apply-release-notes-template]
5866
env:
5967
CONTAINER_FLAVOR: ${{ matrix.flavor }}

.github/workflows/wc-acceptance-test.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ on:
77
flavor:
88
required: true
99
type: string
10+
secrets:
11+
TEST_GITHUB_TOKEN:
12+
required: true
13+
TEST_GITHUB_USER:
14+
required: true
15+
TEST_GITHUB_PASSWORD:
16+
required: true
17+
TEST_GITHUB_TOTP_SECRET:
18+
required: true
1019

1120
concurrency:
1221
group: ${{ github.workflow }}

.github/workflows/wc-build-push-test.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ on:
88
required: false
99
type: boolean
1010
default: true
11+
secrets:
12+
TEST_GITHUB_TOKEN:
13+
required: true
14+
TEST_GITHUB_USER:
15+
required: true
16+
TEST_GITHUB_PASSWORD:
17+
required: true
18+
TEST_GITHUB_TOTP_SECRET:
19+
required: true
1120

1221
permissions:
1322
contents: read
@@ -55,7 +64,6 @@ jobs:
5564
runner: ["ubuntu-latest", "ubuntu-24.04-arm"]
5665
needs: build-push
5766
uses: ./.github/workflows/wc-integration-test.yml
58-
secrets: inherit
5967
with:
6068
flavor: ${{ matrix.flavor }}
6169
runner: ${{ matrix.runner }}
@@ -66,7 +74,11 @@ jobs:
6674
flavor: [cpp]
6775
needs: build-push
6876
uses: ./.github/workflows/wc-acceptance-test.yml
69-
secrets: inherit
77+
secrets:
78+
TEST_GITHUB_TOKEN: ${{ secrets.TEST_GITHUB_TOKEN }}
79+
TEST_GITHUB_USER: ${{ secrets.TEST_GITHUB_USER }}
80+
TEST_GITHUB_PASSWORD: ${{ secrets.TEST_GITHUB_PASSWORD }}
81+
TEST_GITHUB_TOTP_SECRET: ${{ secrets.TEST_GITHUB_TOTP_SECRET }}
7082
with:
7183
flavor: ${{ matrix.flavor }}
7284

0 commit comments

Comments
 (0)