Skip to content

Commit 8b8a21f

Browse files
cjithaJeztah
authored andcommitted
Harden GITHUB_TOKEN permissions
Signed-off-by: Craig Ingram <[email protected]> (cherry picked from commit a270d6e) Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent cf13b64 commit 8b8a21f

File tree

8 files changed

+35
-1
lines changed

8 files changed

+35
-1
lines changed

.github/workflows/build-test-images.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ on:
2020
default: westeurope
2121

2222
permissions:
23-
packages: write
23+
contents: read
2424

2525
env:
2626
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUB_ID }}
@@ -30,6 +30,8 @@ env:
3030

3131
jobs:
3232
images:
33+
permissions:
34+
packages: write
3335
name: "Build volume test images"
3436
runs-on: ubuntu-latest
3537
defaults:

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,17 @@ env:
1414
# Note: don't forget to update `Binaries` step, as it contains the matrix of all supported Go versions.
1515
GO_VERSION: '1.18.9'
1616

17+
permissions: # added using https://github.com/step-security/secure-workflows
18+
contents: read
19+
1720
jobs:
1821
#
1922
# golangci-lint
2023
#
2124
linters:
25+
permissions:
26+
contents: read # for actions/checkout to fetch code
27+
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
2228
name: Linters
2329
runs-on: ${{ matrix.os }}
2430
timeout-minutes: 10

.github/workflows/codeql.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,16 @@ on:
1010
- main
1111
- 'release/**'
1212

13+
permissions: # added using https://github.com/step-security/secure-workflows
14+
contents: read
15+
1316
jobs:
1417
CodeQL-Build:
1518

19+
permissions:
20+
actions: read # for github/codeql-action/init to get workflow details
21+
contents: read # for actions/checkout to fetch code
22+
security-events: write # for github/codeql-action/analyze to upload SARIF results
1623
strategy:
1724
fail-fast: false
1825

.github/workflows/images.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
image:
1010
description: "Target image name (override)"
1111

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

1315
jobs:
1416
mirror:

.github/workflows/nightly.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
env:
1010
GO_VERSION: '1.18.9'
1111

12+
permissions: # added using https://github.com/step-security/secure-workflows
13+
contents: read
14+
1215
jobs:
1316
linux:
1417
name: Linux

.github/workflows/release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ name: Containerd Release
88
env:
99
GO_VERSION: '1.18.9'
1010

11+
permissions: # added using https://github.com/step-security/secure-workflows
12+
contents: read
13+
1114
jobs:
1215
check:
1316
name: Check Signed Tag
@@ -127,6 +130,8 @@ jobs:
127130

128131
release:
129132
name: Create containerd Release
133+
permissions:
134+
contents: write
130135
runs-on: ubuntu-20.04
131136
timeout-minutes: 10
132137
needs: [build, check]

.github/workflows/windows-periodic-trigger.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,16 @@ on:
77
schedule:
88
- cron: "0 1 * * *"
99

10+
permissions: # added using https://github.com/step-security/secure-workflows
11+
contents: read
12+
1013
jobs:
1114

1215
triggerWinIntegration:
16+
# NOTE: the following permissions are required by `google-github-actions/auth`:
17+
permissions:
18+
contents: 'read'
19+
id-token: 'write'
1320
if: github.repository == 'containerd/containerd'
1421
# NOTE(aznashwan, 11/24/21): GitHub actions do not currently support referencing
1522
# or evaluating any kind of variables in the `uses` clause, but this will

.github/workflows/windows-periodic.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ env:
2727
RESOURCE_CONSUMER_TESTING_IMAGE_REF: "registry.k8s.io/e2e-test-images/resource-consumer:1.10"
2828
WEBSERVER_TESTING_IMAGE_REF: "registry.k8s.io/e2e-test-images/nginx:1.14-2"
2929

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

3133
jobs:
3234
winIntegration:

0 commit comments

Comments
 (0)