Skip to content

Commit 39cd0a7

Browse files
authored
Merge pull request #290 from smallstep/carl/add-zizmor-frizbee
Add zizmor and frizbee CI/CD security checks
2 parents 3ff6a7f + 9380018 commit 39cd0a7

12 files changed

Lines changed: 91 additions & 9 deletions

.github/workflows/actionlint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ jobs:
99
steps:
1010
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1111
- name: Check workflow files
12-
uses: docker://rhysd/actionlint:latest
12+
uses: docker://index.docker.io/rhysd/actionlint@sha256:6f03470d0152251d7f07f7c4dc019dbe7024c72cd952f839544c7798843efa8f # 1.7.11
1313
with:
1414
args: -color

.github/workflows/ci.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111
- opened
1212
- synchronize
1313

14+
permissions:
15+
contents: read
16+
1417
concurrency:
1518
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1619
cancel-in-progress: true
@@ -20,6 +23,14 @@ jobs:
2023
name: Lint GitHub workflows
2124
uses: ./.github/workflows/actionlint.yml
2225

26+
zizmor:
27+
name: Scan GitHub workflows
28+
uses: ./.github/workflows/zizmor.yml
29+
30+
frizbee:
31+
name: Check action pinning
32+
uses: ./.github/workflows/frizbee.yml
33+
2334
lint-dummy-app: # NOTE(@azazeal): this check is here to verify that .golangci.yml is valid
2435
name: Lint dummy app
2536
runs-on: ubuntu-latest

.github/workflows/code-scan.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ on:
66
type: boolean
77
default: true
88

9+
permissions:
10+
actions: read
11+
contents: read
12+
security-events: write
13+
914
jobs:
1015
codeql:
1116
if: inputs.run-codeql
12-
uses: smallstep/workflows/.github/workflows/codeql-analysis.yml@main
17+
uses: ./.github/workflows/codeql-analysis.yml

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
~/go/pkg/mod || true
7373
-
7474
name: Action Cache
75-
uses: actions/cache@v5
75+
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
7676
with:
7777
path: |
7878
~/.cache/go-build

.github/workflows/dependabot-auto-merge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ permissions: {}
1111
jobs:
1212
dependabot:
1313
runs-on: ubuntu-latest
14-
if: ${{ github.actor == 'dependabot[bot]' }}
14+
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
1515
permissions:
1616
contents: write
1717
pull-requests: write

.github/workflows/docker-buildx-push.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,8 @@ jobs:
6969
build-args: ${{ inputs.docker_build_args }}
7070
- name: Cosign
7171
id: cosign
72+
env:
73+
DOCKER_IMAGE: ${{ inputs.docker_image }}
74+
DIGEST: ${{ steps.build-and-push.outputs.digest }}
7275
run: |
73-
cosign sign -r ${{ inputs.docker_image }}@${{ steps.build-and-push.outputs.digest }} --yes
76+
cosign sign -r "${DOCKER_IMAGE}@${DIGEST}" --yes

.github/workflows/frizbee.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Frizbee pinning check
2+
on:
3+
workflow_call:
4+
5+
jobs:
6+
frizbee:
7+
name: Check action pinning
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: read
11+
steps:
12+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
13+
with:
14+
persist-credentials: false
15+
- name: Install frizbee
16+
env:
17+
GITHUB_TOKEN: ${{ github.token }}
18+
run: |
19+
gh release download v0.1.8 --repo stacklok/frizbee \
20+
--pattern 'frizbee_0.1.8_linux_amd64.tar.gz' \
21+
--output frizbee.tar.gz
22+
tar -xzf frizbee.tar.gz frizbee
23+
sudo mv frizbee /usr/local/bin/
24+
rm frizbee.tar.gz
25+
- name: Check pinning
26+
env:
27+
GITHUB_TOKEN: ${{ github.token }}
28+
run: frizbee actions --dry-run --error .github/workflows/

.github/workflows/goCI.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
permissions:
2+
contents: read
3+
14
on:
25
workflow_call:
36
inputs:
@@ -90,7 +93,7 @@ jobs:
9093
steps:
9194
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
9295
- name: Check workflow files
93-
uses: docker://rhysd/actionlint:latest
96+
uses: docker://index.docker.io/rhysd/actionlint@sha256:6f03470d0152251d7f07f7c4dc019dbe7024c72cd952f839544c7798843efa8f # 1.7.11
9497
with:
9598
args: -color
9699

@@ -120,6 +123,10 @@ jobs:
120123

121124
codeql:
122125
if: inputs.run-codeql
126+
permissions:
127+
actions: read
128+
contents: read
129+
security-events: write
123130
uses: ./.github/workflows/codeql-analysis.yml
124131
with:
125132
goprivate: ${{ inputs.goprivate }}
@@ -145,6 +152,12 @@ jobs:
145152
PAT: ${{ secrets.PAT }}
146153
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
147154

155+
zizmor:
156+
uses: ./.github/workflows/zizmor.yml
157+
158+
frizbee:
159+
uses: ./.github/workflows/frizbee.yml
160+
148161
build:
149162
uses: ./.github/workflows/goBuild.yml
150163
if: inputs.run-build

.github/workflows/goTest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ jobs:
107107
~/go/pkg/mod || true
108108
-
109109
name: Action Cache
110-
uses: actions/cache@v5
110+
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
111111
with:
112112
path: |
113113
~/.cache/go-build

.github/workflows/goreleaser.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,15 @@ jobs:
130130
name: Authenticate to Google Cloud
131131
if: inputs.enable-packages-upload
132132
id: gcloud-auth
133-
uses: google-github-actions/auth@v3
133+
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3
134134
with:
135135
token_format: access_token
136136
workload_identity_provider: ${{ secrets.GOOGLE_CLOUD_WORKLOAD_IDENTITY_PROVIDER }}
137137
service_account: ${{ secrets.GOOGLE_CLOUD_GITHUB_SERVICE_ACCOUNT }}
138138
-
139139
name: Set up Google Cloud SDK
140140
if: inputs.enable-packages-upload
141-
uses: google-github-actions/setup-gcloud@v3
141+
uses: google-github-actions/setup-gcloud@aa5489c8933f4cc7a4f7d45035b3b1440c9c10db # v3
142142
with:
143143
project_id: ${{ secrets.GOOGLE_CLOUD_PACKAGES_PROJECT_ID }}
144144
-

0 commit comments

Comments
 (0)