Skip to content

Commit 728411c

Browse files
committed
Grant GitHub Actions workflows access to OIDC token
In rust-lang#3909, new steps were added to the GitHub Actions workflows that upload the build artifacts to a new S3 bucket. Authentication is done using short-lived tokens that are provisioned using OIDC. This scheme requires additional permissions[^1], which have been granted to the workflows. [^1]: https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#adding-permissions-settings
1 parent 556f7ee commit 728411c

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ jobs:
2424
if: ${{ contains('["pull_request", "merge_group"]', github.event_name) }} # skip-master skip-stable
2525
env:
2626
RUSTFLAGS: -Ctarget-feature=+crt-static
27+
permissions:
28+
id-token: write
2729
strategy:
2830
fail-fast: false
2931
matrix:
@@ -178,6 +180,8 @@ jobs:
178180
if: ${{ (github.event_name == 'push' && github.ref_name == 'master') || github.event_name == 'schedule' }} # skip-pr skip-stable
179181
env:
180182
RUSTFLAGS: -Ctarget-feature=+crt-static
183+
permissions:
184+
id-token: write
181185
strategy:
182186
fail-fast: false
183187
matrix:
@@ -332,6 +336,8 @@ jobs:
332336
if: ${{ github.event_name == 'push' && github.ref_name == 'stable' }} # skip-pr skip-master
333337
env:
334338
RUSTFLAGS: -Ctarget-feature=+crt-static
339+
permissions:
340+
id-token: write
335341
strategy:
336342
fail-fast: false
337343
matrix:
@@ -490,6 +496,8 @@ jobs:
490496
build-linux-pr: # job-name skip-master skip-stable
491497
runs-on: ubuntu-latest
492498
if: ${{ contains('["pull_request", "merge_group"]', github.event_name) }} # skip-master skip-stable
499+
permissions:
500+
id-token: write
493501
strategy:
494502
fail-fast: false
495503
matrix:
@@ -646,6 +654,8 @@ jobs:
646654
build-linux-master: # job-name skip-pr skip-stable
647655
runs-on: ubuntu-latest
648656
if: ${{ (github.event_name == 'push' && github.ref_name == 'master') || github.event_name == 'schedule' }} # skip-pr skip-stable
657+
permissions:
658+
id-token: write
649659
strategy:
650660
fail-fast: false
651661
matrix:
@@ -807,6 +817,8 @@ jobs:
807817
build-linux-stable: # job-name skip-master skip-pr
808818
runs-on: ubuntu-latest
809819
if: ${{ github.event_name == 'push' && github.ref_name == 'stable' }} # skip-pr skip-master
820+
permissions:
821+
id-token: write
810822
strategy:
811823
fail-fast: false
812824
matrix:
@@ -990,6 +1002,8 @@ jobs:
9901002
runs-on: macos-13 # skip-aarch64
9911003
env: # skip-aarch64
9921004
MACOSX_DEPLOYMENT_TARGET: 10.12 # skip-aarch64
1005+
permissions:
1006+
id-token: write
9931007
strategy:
9941008
matrix:
9951009
mode:
@@ -1118,6 +1132,8 @@ jobs:
11181132
runs-on: macos-latest # skip-x86_64
11191133
env: # skip-x86_64
11201134
MACOSX_DEPLOYMENT_TARGET: 11.0 # skip-x86_64
1135+
permissions:
1136+
id-token: write
11211137
strategy:
11221138
matrix:
11231139
mode:

ci/actions-templates/linux-builds-template.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ jobs: # skip-master skip-pr skip-stable
99
if: ${{ contains('["pull_request", "merge_group"]', github.event_name) }} # skip-master skip-stable
1010
if: ${{ (github.event_name == 'push' && github.ref_name == 'master') || github.event_name == 'schedule' }} # skip-pr skip-stable
1111
if: ${{ github.event_name == 'push' && github.ref_name == 'stable' }} # skip-pr skip-master
12+
permissions:
13+
id-token: write
1214
strategy:
1315
fail-fast: false
1416
matrix:

ci/actions-templates/macos-builds-template.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ jobs: # skip-x86_64 skip-aarch64
1010
runs-on: macos-13 # skip-aarch64
1111
env: # skip-aarch64
1212
MACOSX_DEPLOYMENT_TARGET: 10.12 # skip-aarch64
13+
permissions:
14+
id-token: write
1315
strategy:
1416
matrix:
1517
mode:

ci/actions-templates/windows-builds-template.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ jobs: # skip-master skip-pr skip-stable
1111
if: ${{ github.event_name == 'push' && github.ref_name == 'stable' }} # skip-pr skip-master
1212
env:
1313
RUSTFLAGS: -Ctarget-feature=+crt-static
14+
permissions:
15+
id-token: write
1416
strategy:
1517
fail-fast: false
1618
matrix:

0 commit comments

Comments
 (0)