Skip to content

Commit

Permalink
Grant GitHub Actions workflows access to OIDC token
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jdno committed Jul 9, 2024
1 parent 556f7ee commit 728411c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
if: ${{ contains('["pull_request", "merge_group"]', github.event_name) }} # skip-master skip-stable
env:
RUSTFLAGS: -Ctarget-feature=+crt-static
permissions:
id-token: write
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -178,6 +180,8 @@ jobs:
if: ${{ (github.event_name == 'push' && github.ref_name == 'master') || github.event_name == 'schedule' }} # skip-pr skip-stable
env:
RUSTFLAGS: -Ctarget-feature=+crt-static
permissions:
id-token: write
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -332,6 +336,8 @@ jobs:
if: ${{ github.event_name == 'push' && github.ref_name == 'stable' }} # skip-pr skip-master
env:
RUSTFLAGS: -Ctarget-feature=+crt-static
permissions:
id-token: write
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -490,6 +496,8 @@ jobs:
build-linux-pr: # job-name skip-master skip-stable
runs-on: ubuntu-latest
if: ${{ contains('["pull_request", "merge_group"]', github.event_name) }} # skip-master skip-stable
permissions:
id-token: write
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -646,6 +654,8 @@ jobs:
build-linux-master: # job-name skip-pr skip-stable
runs-on: ubuntu-latest
if: ${{ (github.event_name == 'push' && github.ref_name == 'master') || github.event_name == 'schedule' }} # skip-pr skip-stable
permissions:
id-token: write
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -807,6 +817,8 @@ jobs:
build-linux-stable: # job-name skip-master skip-pr
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.ref_name == 'stable' }} # skip-pr skip-master
permissions:
id-token: write
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -990,6 +1002,8 @@ jobs:
runs-on: macos-13 # skip-aarch64
env: # skip-aarch64
MACOSX_DEPLOYMENT_TARGET: 10.12 # skip-aarch64
permissions:
id-token: write
strategy:
matrix:
mode:
Expand Down Expand Up @@ -1118,6 +1132,8 @@ jobs:
runs-on: macos-latest # skip-x86_64
env: # skip-x86_64
MACOSX_DEPLOYMENT_TARGET: 11.0 # skip-x86_64
permissions:
id-token: write
strategy:
matrix:
mode:
Expand Down
2 changes: 2 additions & 0 deletions ci/actions-templates/linux-builds-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ jobs: # skip-master skip-pr skip-stable
if: ${{ contains('["pull_request", "merge_group"]', github.event_name) }} # skip-master skip-stable
if: ${{ (github.event_name == 'push' && github.ref_name == 'master') || github.event_name == 'schedule' }} # skip-pr skip-stable
if: ${{ github.event_name == 'push' && github.ref_name == 'stable' }} # skip-pr skip-master
permissions:
id-token: write
strategy:
fail-fast: false
matrix:
Expand Down
2 changes: 2 additions & 0 deletions ci/actions-templates/macos-builds-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ jobs: # skip-x86_64 skip-aarch64
runs-on: macos-13 # skip-aarch64
env: # skip-aarch64
MACOSX_DEPLOYMENT_TARGET: 10.12 # skip-aarch64
permissions:
id-token: write
strategy:
matrix:
mode:
Expand Down
2 changes: 2 additions & 0 deletions ci/actions-templates/windows-builds-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs: # skip-master skip-pr skip-stable
if: ${{ github.event_name == 'push' && github.ref_name == 'stable' }} # skip-pr skip-master
env:
RUSTFLAGS: -Ctarget-feature=+crt-static
permissions:
id-token: write
strategy:
fail-fast: false
matrix:
Expand Down

0 comments on commit 728411c

Please sign in to comment.