Skip to content

Commit bdd12fb

Browse files
flavorjonesclaude
andauthored
ci: harden GitHub Actions workflows (#73)
* Pin GitHub Actions to SHA hashes Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Address zizmor warnings: artipacked and excessive-permissions - Add persist-credentials: false to checkout steps (artipacked) - Add permissions: {} at workflow level and contents: read per job (excessive-permissions) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Suppress unpinned-images for service container images Version tags already pin to specific releases; digest pinning for multi-arch images is nontrivial. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Add lint-actions CI job for actionlint and zizmor Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Configure dependabot for GitHub Actions with weekly batched updates Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Update unpinned-images suppression comments Use more accurate wording that doesn't imply Docker tags are immutable. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 76408f0 commit bdd12fb

2 files changed

Lines changed: 45 additions & 6 deletions

File tree

‎.github/dependabot.yml‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: "/"
5+
groups:
6+
github-actions:
7+
patterns:
8+
- "*"
9+
schedule:
10+
interval: weekly
11+
cooldown:
12+
default-days: 7

‎.github/workflows/build.yml‎

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,49 @@ on:
55
pull_request:
66
types: [ opened, synchronize ]
77

8+
permissions: {}
9+
810
jobs:
911
rubocop:
1012
name: Rubocop
1113
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
1216
steps:
1317
- name: Checkout code
14-
uses: actions/checkout@v4
18+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
19+
with:
20+
persist-credentials: false
1521
- name: Setup Ruby and install gems
16-
uses: ruby/setup-ruby@v1
22+
uses: ruby/setup-ruby@319994f95fa847cf3fb3cd3dbe89f6dcde9f178f # v1.295.0
1723
with:
1824
ruby-version: '4.0'
1925
bundler-cache: true
2026
- name: Run rubocop
2127
run: |
2228
bundle exec rubocop --parallel
29+
lint-actions:
30+
name: GitHub Actions audit
31+
runs-on: ubuntu-latest
32+
permissions:
33+
contents: read
34+
steps:
35+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
36+
with:
37+
persist-credentials: false
38+
39+
- name: Run actionlint
40+
uses: rhysd/actionlint@393031adb9afb225ee52ae2ccd7a5af5525e03e8 # v1.7.11
41+
42+
- name: Run zizmor
43+
uses: zizmorcore/zizmor-action@71321a20a9ded102f6e9ce5718a2fcec2c4f70d8 # v0.5.2
44+
with:
45+
advanced-security: false
2346
tests:
2447
name: Ruby ${{ matrix.ruby-version }}, ${{ matrix.rails-version }}, ${{ matrix.database }}
2548
runs-on: ubuntu-latest
49+
permissions:
50+
contents: read
2651
strategy:
2752
fail-fast: false
2853
matrix:
@@ -32,7 +57,7 @@ jobs:
3257
continue-on-error: ${{ matrix.rails-version == 'rails_edge' }}
3358
services:
3459
postgres:
35-
image: postgres:16
60+
image: postgres:16 # zizmor: ignore[unpinned-images] -- version tag is fine for service containers
3661
env:
3762
POSTGRES_HOST_AUTH_METHOD: "trust"
3863
options: >-
@@ -43,7 +68,7 @@ jobs:
4368
ports:
4469
- 55433:5432
4570
mysql:
46-
image: mysql:8.0
71+
image: mysql:8.0 # zizmor: ignore[unpinned-images] -- version tag is fine for service containers
4772
env:
4873
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
4974
options: >-
@@ -58,9 +83,11 @@ jobs:
5883
TARGET_DB: ${{ matrix.database }}
5984
steps:
6085
- name: Checkout code
61-
uses: actions/checkout@v4
86+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
87+
with:
88+
persist-credentials: false
6289
- name: Setup Ruby and install gems
63-
uses: ruby/setup-ruby@v1
90+
uses: ruby/setup-ruby@319994f95fa847cf3fb3cd3dbe89f6dcde9f178f # v1.295.0
6491
with:
6592
ruby-version: ${{ matrix.ruby-version }}
6693
bundler-cache: true

0 commit comments

Comments
 (0)