Skip to content

Commit

Permalink
Harden GITHUB_TOKEN permissions
Browse files Browse the repository at this point in the history
Signed-off-by: Craig Ingram <cjingram@google.com>
(cherry picked from commit a270d6e)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
cji authored and thaJeztah committed Jan 24, 2023
1 parent cf13b64 commit 8b8a21f
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/workflows/build-test-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ on:
default: westeurope

permissions:
packages: write
contents: read

env:
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUB_ID }}
Expand All @@ -30,6 +30,8 @@ env:

jobs:
images:
permissions:
packages: write
name: "Build volume test images"
runs-on: ubuntu-latest
defaults:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,17 @@ env:
# Note: don't forget to update `Binaries` step, as it contains the matrix of all supported Go versions.
GO_VERSION: '1.18.9'

permissions: # added using https://github.com/step-security/secure-workflows
contents: read

jobs:
#
# golangci-lint
#
linters:
permissions:
contents: read # for actions/checkout to fetch code
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
name: Linters
runs-on: ${{ matrix.os }}
timeout-minutes: 10
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,16 @@ on:
- main
- 'release/**'

permissions: # added using https://github.com/step-security/secure-workflows
contents: read

jobs:
CodeQL-Build:

permissions:
actions: read # for github/codeql-action/init to get workflow details
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/analyze to upload SARIF results
strategy:
fail-fast: false

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
image:
description: "Target image name (override)"

permissions: # added using https://github.com/step-security/secure-workflows
contents: read

jobs:
mirror:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
env:
GO_VERSION: '1.18.9'

permissions: # added using https://github.com/step-security/secure-workflows
contents: read

jobs:
linux:
name: Linux
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ name: Containerd Release
env:
GO_VERSION: '1.18.9'

permissions: # added using https://github.com/step-security/secure-workflows
contents: read

jobs:
check:
name: Check Signed Tag
Expand Down Expand Up @@ -127,6 +130,8 @@ jobs:

release:
name: Create containerd Release
permissions:
contents: write
runs-on: ubuntu-20.04
timeout-minutes: 10
needs: [build, check]
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/windows-periodic-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@ on:
schedule:
- cron: "0 1 * * *"

permissions: # added using https://github.com/step-security/secure-workflows
contents: read

jobs:

triggerWinIntegration:
# NOTE: the following permissions are required by `google-github-actions/auth`:
permissions:
contents: 'read'
id-token: 'write'
if: github.repository == 'containerd/containerd'
# NOTE(aznashwan, 11/24/21): GitHub actions do not currently support referencing
# or evaluating any kind of variables in the `uses` clause, but this will
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/windows-periodic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ env:
RESOURCE_CONSUMER_TESTING_IMAGE_REF: "registry.k8s.io/e2e-test-images/resource-consumer:1.10"
WEBSERVER_TESTING_IMAGE_REF: "registry.k8s.io/e2e-test-images/nginx:1.14-2"

permissions: # added using https://github.com/step-security/secure-workflows
contents: read

jobs:
winIntegration:
Expand Down

0 comments on commit 8b8a21f

Please sign in to comment.