Skip to content

Commit

Permalink
fix(ci): tighten GHA permissions (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
tallaxes authored Jan 26, 2024
1 parent a7a58e2 commit 31b0dfc
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 8 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/build-publish-mcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ on:
type: string

permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
contents: read

env:
REGISTRY_REPO: unlisted/aks/karpenter
Expand Down Expand Up @@ -41,6 +40,8 @@ jobs:
echo "release_tag=$RELEASE_TAG" >> $GITHUB_OUTPUT
publish-images:
permissions:
id-token: write # This is required for requesting the JWT
runs-on: ubuntu-latest
needs: prepare-variables
steps:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ on:
branches: [main]
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
ci-test:
permissions:
statuses: write
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
branches: [main]
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
ci:
runs-on: ubuntu-latest
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/deflake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ on:
schedule:
- cron: '0 12 * * *'
workflow_dispatch:

permissions:
contents: read
jobs:
deflake:
runs-on: ubuntu-latest
permissions:
statuses: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/e2e-matrix-trigger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@ on:
workflow_run:
workflows: [ApprovalComment]
types: [completed]

permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
statuses: write # ./.github/actions/commit-status/*
contents: read

jobs:
resolve:
if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success'
uses: ./.github/workflows/resolve-args.yaml
e2e-matrix:
permissions:
id-token: write # This is required for requesting the JWT
statuses: write # ./.github/actions/commit-status/*
needs: [resolve]
uses: ./.github/workflows/e2e-matrix.yaml
with:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/e2e-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ on:
required: true
E2E_SUBSCRIPTION_ID:
required: true

permissions:
contents: read

jobs:
initialize-generative-params:
runs-on: ubuntu-latest
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@ on:
required: true
E2E_SUBSCRIPTION_ID:
required: true

permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
statuses: write # ./.github/actions/commit-status/*
contents: read

jobs:
run-suite:
name: suite-${{ inputs.suite }}
runs-on: ubuntu-latest
permissions:
id-token: write # This is required for requesting the JWT
statuses: write # ./.github/actions/commit-status/*
env:
AZURE_SUBSCRIPTION_ID: ${{ secrets.E2E_SUBSCRIPTION_ID }}
steps:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/resolve-args.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
outputs:
GIT_REF:
value: ${{ jobs.resolve.outputs.GIT_REF }}

permissions:
contents: read

jobs:
resolve:
runs-on: ubuntu-latest
Expand Down

0 comments on commit 31b0dfc

Please sign in to comment.