ci: pin GitHub Actions to commit SHAs and add zizmor to CI - #126
Merged
Conversation
Add workflow-level 'permissions: contents: read' to lint.yml and test.yml, which previously inherited the default token scope. Set persist-credentials: false on every checkout that only reads. The wiki checkout in sync-wiki.yml keeps its persisted credentials -- the push step depends on them -- and carries a comment plus a zizmor ignore so the unsafe auto-fix is not applied to it. Refs #124 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Add zizmor to requirements-dev.txt (pinned, so CI and local runs agree) and run 'zizmor --min-severity high .github/workflows/' in the lint job, which fails the build on High-severity findings. Extend renovate with helpers:pinGitHubActionDigests so newly added actions are pinned and existing digests stay current; the automerge rule already covers the resulting digest updates. Refs #124 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The baseline recorded the open_notebook molecule test password at line 28; it has been at line 39 for some time, so 'prek run --all-files' failed on main. No new secrets are baselined. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Owner
Author
Review — issue #124
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pins every GitHub Actions reference to a commit SHA and adds a zizmor gate to CI.
Closes #124
Changes
Pin actions to commit SHAs. All 8 references to
actions/checkoutandactions/setup-pythonacrosslint.yml,test.yml, andsync-wiki.ymlmovefrom the mutable
@v7major tag to a full commit SHA with a trailing# v7comment:
actions/checkout3d3c42e5aac5ba805825da76410c181273ba90b1actions/setup-python5fda3b95a4ea91299a34e894583c3862153e4b97Renovate keeps digests current.
helpers:pinGitHubActionDigestsis added toextendsinrenovate.json5. The existing automerge rule already listsdigestinmatchUpdateTypes, so digest refreshes merge without review burden.zizmor runs in CI.
zizmor==1.28.0is added torequirements-dev.txt, whichthe lint job already installs, and the lint job gains a
zizmor --min-severity high .github/workflows/step that fails the build onHigh-severity findings. Installing via pip rather than a marketplace action
avoids introducing another action dependency to pin, and keeps local runs on the
same version as CI. The exact pin means a new zizmor release cannot turn a fresh
audit rule into an unrelated CI failure; Renovate proposes bumps as PRs.
Least-privilege permissions.
lint.ymlandtest.ymlhad nopermissions:block and inherited the default token scope. Both now declare workflow-level
contents: read.Credential persistence.
persist-credentials: falseis set on the fourcheckouts that only read.
The wiki checkout in
sync-wiki.ymlis deliberately left persisting itscredentials: the
git pushstep relies onWIKI_TOKENbeing written to thatcheckout's
.git/config. Settingpersist-credentials: falsethere — whichzizmor offers as an auto-fix — would break the wiki sync. The step carries a
comment explaining this and a
# zizmor: ignore[artipacked]marker so theauto-fix is not applied later.
Also included
.secrets.baselinerecorded the open_notebook molecule test password at line 28;it has been at line 39 for some time, so
prek run --all-filesfailed onmainbefore this branch. The baseline is refreshed. No new secrets are baselined —
the diff is one line number and the timestamp.
Verification
Run locally on the branch head, each checked by exit code:
zizmor .github/workflows/zizmor --min-severity high .github/workflows/actionlintmake lint.venv/bin/pytestprek run --all-fileszizmor on
mainreported 8 High (unpinned-uses), 4 Medium(
excessive-permissions), and 5 Low (artipacked). All 17 are resolved; the oneremaining finding is the intentional wiki-checkout
artipacked, explicitlyignored.
Checked that nothing depended on what was removed: neither
lint.ymlnortest.ymlruns any git operation,requirements.ymlsources no collections overSCM, and Molecule pulls
fedora:43from Docker Hub rather than GHCR, so nopackages:readscope is required.🤖 Generated with Claude Code