Skip to content

Commit 5e9eccd

Browse files
authored
chore: run zizmor on workflows and fix issues (#366)
I ran `zizmor .` and had an agent work through the changes. The changes included, - SHA pinning - Removing template injection risks - Minimizing permissions and scoping to just needed - Removing some caching, leaving other caching in place since it's guarded reasonably well - Adding `persist_credentials: false` to actions/checkout steps - Switching on pull_request_target workflow to pull_request which runs with lesser permissions
1 parent 85ad986 commit 5e9eccd

8 files changed

Lines changed: 71 additions & 36 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,13 @@ jobs:
5858
5959
- name: Download release artifacts
6060
run: |
61-
gh release download ${{ inputs.release_tag }} --repo ${{ github.repository }}
61+
gh release download "${RELEASE_TAG}" --repo "${GITHUB_REPOSITORY}"
6262
env:
63+
RELEASE_TAG: ${{ inputs.release_tag }}
6364
GH_TOKEN: ${{ github.token }}
6465

6566
- name: Upload artifacts
6667
run: |
67-
aws s3 cp . s3://dbc-distribution/${{ inputs.release_tag }} --recursive
68+
aws s3 cp . "s3://dbc-distribution/${RELEASE_TAG}" --recursive
69+
env:
70+
RELEASE_TAG: ${{ inputs.release_tag }}

.github/workflows/dev.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,18 @@ jobs:
2828
name: Run pre-commit hooks
2929
runs-on: ubuntu-latest
3030
steps:
31-
- uses: actions/checkout@v6
32-
- uses: actions/setup-python@v6
31+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
32+
with:
33+
persist-credentials: false
34+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
3335
with:
3436
python-version: '3.x'
3537

3638
- name: Install pre-commit
3739
run: pip install pre-commit
3840

3941
- name: Cache pre-commit
40-
uses: actions/cache@v5
42+
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
4143
with:
4244
path: ~/.cache/pre-commit
4345
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}

.github/workflows/dev_pr.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
name: Dev PR
1616

1717
on:
18-
pull_request_target:
18+
pull_request:
1919
types: [opened, edited, synchronize, ready_for_review, review_requested]
2020

2121
permissions:
@@ -27,14 +27,18 @@ jobs:
2727
name: Check PR Title
2828
runs-on: ubuntu-latest
2929
steps:
30-
- uses: actions/checkout@v4
30+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
31+
with:
32+
persist-credentials: false
3133
- name: Setup Node.js
32-
uses: actions/setup-node@v4
34+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
3335
with:
3436
node-version: '18'
3537
- name: Install commitlint
3638
run: |
3739
npm install @commitlint/cli @commitlint/config-conventional
3840
- name: Check PR title follows conventional commits spec
3941
run: |
40-
echo "${{ github.event.pull_request.title }}" | npx commitlint --extends @commitlint/config-conventional
42+
echo "${PR_TITLE}" | npx commitlint --extends @commitlint/config-conventional
43+
env:
44+
PR_TITLE: ${{ github.event.pull_request.title }}

.github/workflows/go.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ jobs:
4646
# macos-15 is intel macos while macos-latest is arm64
4747
os: [ 'ubuntu-latest', 'windows-latest', 'macos-latest', 'macos-15' ]
4848
steps:
49-
- uses: actions/checkout@v4
49+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
50+
with:
51+
persist-credentials: false
5052
- name: Install Go
5153
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
5254
with:

.github/workflows/integration.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ jobs:
4848
matrix:
4949
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
5050
steps:
51-
- uses: actions/checkout@v4
51+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
52+
with:
53+
persist-credentials: false
5254

5355
- name: Install Go
5456
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
@@ -58,7 +60,7 @@ jobs:
5860
cache-dependency-path: go.sum
5961

6062
- name: Install Python
61-
uses: actions/setup-python@v6
63+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
6264
with:
6365
python-version: "3.13"
6466

.github/workflows/publish_docs.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,30 @@ concurrency:
2323
group: "pages"
2424
cancel-in-progress: true
2525

26+
permissions: {}
27+
2628
jobs:
2729
build:
2830
runs-on: ubuntu-latest
31+
permissions:
32+
contents: read
2933
steps:
30-
- uses: actions/checkout@v4
34+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
35+
with:
36+
persist-credentials: false
3137
- uses: prefix-dev/setup-pixi@82d477f15f3a381dbcc8adc1206ce643fe110fb7
3238
with:
3339
pixi-version: v0.59.0
3440
cache: true
3541
environments: docs
36-
- uses: actions/cache@v4
42+
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
3743
with:
3844
key: mkdocs-material-${{ github.ref }}
3945
path: ~/.cache
4046
- name: Build site
4147
run: pixi run -e docs mkdocs build --strict
4248
- name: Upload built site as artifact
43-
uses: actions/upload-pages-artifact@v3
49+
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
4450
with:
4551
path: ./site
4652

@@ -57,4 +63,4 @@ jobs:
5763
steps:
5864
- name: Deploy to GitHub Pages
5965
id: deployment
60-
uses: actions/deploy-pages@v4
66+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5

.github/workflows/publish_install_script.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ jobs:
3737
environment: production
3838

3939
steps:
40-
- uses: actions/checkout@v5
40+
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
41+
with:
42+
persist-credentials: false
4143
- name: AWS Login
4244
uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4.3.1
4345
with:
@@ -50,5 +52,7 @@ jobs:
5052
aws sts get-caller-identity
5153
- name: Upload install.sh
5254
run: |
53-
aws s3 cp scripts/install.sh s3://${{ vars.AWS_BUCKET }}/install.sh
54-
aws s3 cp scripts/install.ps1 s3://${{ vars.AWS_BUCKET }}/install.ps1
55+
aws s3 cp scripts/install.sh "s3://${AWS_BUCKET}/install.sh"
56+
aws s3 cp scripts/install.ps1 "s3://${AWS_BUCKET}/install.ps1"
57+
env:
58+
AWS_BUCKET: ${{ vars.AWS_BUCKET }}

.github/workflows/release.yml

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,20 @@ on:
2020
- "v*"
2121
pull_request:
2222

23-
permissions:
24-
contents: write
25-
id-token: write # For AWS auth
23+
permissions: {}
2624

2725
jobs:
2826
snapshot:
2927
runs-on: ubuntu-latest
3028
environment: snapshot
3129
if: github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork
30+
permissions:
31+
contents: read
3232
steps:
33-
- uses: actions/checkout@v5
33+
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
3434
with:
3535
fetch-depth: 0
36+
persist-credentials: false
3637
- name: Set up Go
3738
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
3839
with:
@@ -67,19 +68,19 @@ jobs:
6768
gpg-connect-agent "PRESET_PASSPHRASE $KEYGRIP -1 $(echo -n '${{ secrets.SIGNING_PASSWORD }}' | od -An -t x1 | tr -d ' ')"
6869
6970
- name: "Set up Python"
70-
uses: actions/setup-python@v5
71+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
7172

7273
- name: Install uv
73-
uses: astral-sh/setup-uv@v6
74+
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
7475

7576
- name: Install Wheel
7677
run: pip install wheel
7778

7879
- name: Set up QEMU
79-
uses: docker/setup-qemu-action@v3
80+
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
8081

8182
- name: Set up Docker Buildx
82-
uses: docker/setup-buildx-action@v3
83+
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
8384

8485
- name: Run GoReleaser Snapshot
8586
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
@@ -94,7 +95,7 @@ jobs:
9495
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
9596

9697
- name: Upload Snapshot Artifacts
97-
uses: actions/upload-artifact@v4
98+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
9899
with:
99100
name: snapshot-artifacts
100101
path: |
@@ -111,14 +112,19 @@ jobs:
111112
runs-on: ubuntu-latest
112113
environment: production
113114
if: github.event_name == 'push'
115+
permissions:
116+
contents: write
117+
id-token: write # For AWS auth
114118
steps:
115-
- uses: actions/checkout@v5
119+
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
116120
with:
117121
fetch-depth: 0
122+
persist-credentials: false
118123
- name: Set up Go
119124
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
120125
with:
121126
go-version-file: './go.mod'
127+
cache: false
122128

123129
# pull more recent version of wixl than in the ubuntu repos
124130
# needed for Path Env update support
@@ -156,10 +162,12 @@ jobs:
156162
aws-region: ${{ vars.AWS_REGION }}
157163

158164
- name: "Set up Python"
159-
uses: actions/setup-python@v5
165+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
160166

161167
- name: Install uv
162-
uses: astral-sh/setup-uv@v6
168+
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
169+
with:
170+
enable-cache: false
163171

164172
- name: Install Wheel
165173
run: pip install wheel
@@ -171,10 +179,10 @@ jobs:
171179
password: ${{ secrets.DOCKER_TOKEN }}
172180

173181
- name: Set up QEMU
174-
uses: docker/setup-qemu-action@v3
182+
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
175183

176184
- name: Set up Docker Buildx
177-
uses: docker/setup-buildx-action@v3
185+
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
178186

179187
# cross-platform macos notarization/signing
180188
- name: Install anchore/quill
@@ -191,8 +199,8 @@ jobs:
191199
sudo dpkg --install jsign_7.0_all.deb
192200
rm jsign_7.0_all.deb
193201
194-
echo "PKCS11_CONFIG=${{ steps.digicert.outputs.PKCS11_CONFIG }}" >> "$GITHUB_ENV"
195-
SM_TOOLS_DIR=$(dirname "$(realpath '${{ steps.digicert.outputs.PKCS11_CONFIG }}')")
202+
echo "PKCS11_CONFIG=${PKCS11_CONFIG}" >> "$GITHUB_ENV"
203+
SM_TOOLS_DIR=$(dirname "$(realpath "${PKCS11_CONFIG}")")
196204
echo "${{ secrets.SM_CLIENT_CERT_FILE_B64 }}" | base64 -d > "${SM_TOOLS_DIR}/Certificate_pkcs12.p12"
197205
echo "SM_HOST=${{ secrets.SM_HOST }}" >> "$GITHUB_ENV"
198206
echo "SM_API_KEY=${{ secrets.SM_API_KEY }}" >> "$GITHUB_ENV"
@@ -202,6 +210,8 @@ jobs:
202210
203211
# clean up
204212
git clean -xdf
213+
env:
214+
PKCS11_CONFIG: ${{ steps.digicert.outputs.PKCS11_CONFIG }}
205215

206216
- name: Run GoReleaser
207217
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
@@ -236,4 +246,6 @@ jobs:
236246
--if-match=$ETAG \
237247
--kvs-arn=${{ secrets.AWS_CF_KVSTORE_ARN }} \
238248
--key=latest \
239-
--value=${{ fromJSON(steps.gorelease.outputs.metadata).version }}
249+
--value="${RELEASE_VERSION}"
250+
env:
251+
RELEASE_VERSION: ${{ fromJSON(steps.gorelease.outputs.metadata).version }}

0 commit comments

Comments
 (0)