Fix CI: resolve all zizmor security audit findings#20
Merged
Conversation
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Setting
permissions: {}at the workflow level removes all defaultGITHUB_TOKENscopes, which may breakactions/checkout(especially on private repos); consider explicitly granting only the minimal required permissions (e.g.permissions: { contents: read }) instead of an empty object. - Now that actions are pinned, it might be useful to add a brief comment or naming convention around how/when these SHAs should be updated (e.g. via Dependabot) to avoid them silently drifting out of date or being updated manually to tags again.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Setting `permissions: {}` at the workflow level removes all default `GITHUB_TOKEN` scopes, which may break `actions/checkout` (especially on private repos); consider explicitly granting only the minimal required permissions (e.g. `permissions: { contents: read }`) instead of an empty object.
- Now that actions are pinned, it might be useful to add a brief comment or naming convention around how/when these SHAs should be updated (e.g. via Dependabot) to avoid them silently drifting out of date or being updated manually to tags again.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
- Pin all GitHub Actions to SHA hashes (actions/checkout, setup-uv, cache, pre-commit/action, create-pull-request)
- Fix template injection vulnerability by using env vars for github.actor
- Add workflow-level permissions: {} to restrict default token scope
- Add dependabot cooldown configuration
https://claude.ai/code/session_013DBSzYMmxuKo9vsjMwXzJQ
permissions: {} removes all scopes including contents:read, which
breaks actions/checkout on private repos. Grant the minimal required
permission explicitly.
https://claude.ai/code/session_013DBSzYMmxuKo9vsjMwXzJQ
- Pin all GitHub Actions to SHA hashes in ci.yml, weekly-ci.yml, and build-and-publish.yml templates - Move issues:write permission from workflow level to job level in weekly-ci.yml (least-privilege principle) https://claude.ai/code/session_013DBSzYMmxuKo9vsjMwXzJQ
CODECOV_TOKEN is a non-sensitive upload token that doesn't warrant requiring GitHub Environments in every generated project. Explicitly suppress the zizmor finding with inline ignore comments. https://claude.ai/code/session_013DBSzYMmxuKo9vsjMwXzJQ
248ca69 to
677eea3
Compare
Avoids template injection risk entirely by using a fixed identity for the template tester instead of the dynamic github.actor context. https://claude.ai/code/session_013DBSzYMmxuKo9vsjMwXzJQ
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.
Summary
Add the zizmor pre-commit hook for GitHub Actions security auditing, and fix all findings across both the repo's own workflows and the generated project templates.
Changes
New: zizmor pre-commit hook
zizmorhook to.pre-commit-config.yaml(repo) and.pre-commit-config.yaml.jinja(template)Repository workflows (
.github/)uv-tests.ymlanddependabot.ymlgithub.actorwithtemplate-tester/template-tester@example.com, eliminating the template injection vector entirelypermissions: contents: read— restrict defaultGITHUB_TOKENscope (least-privilege)default-days: 7)Generated project templates (
project_name/)ci.yml,weekly-ci.yml,build-and-publish.yml, anddeps-update.ymlissues: writeto job level inweekly-ci.ymlinstead of workflow leveldependabot.ymlsecrets-outside-envforCODECOV_TOKEN— this is a non-sensitive upload token; requiring GitHub Environments would add unnecessary setup burden for generated projectsFindings addressed
unpinned-usestemplate-injectiongithub.actorexcessive-permissionspermissionsblock; scopeissues: writeto jobsdependabot-cooldowncooldown.default-days: 7secrets-outside-env# zizmor: ignore(deliberate)https://claude.ai/code/session_013DBSzYMmxuKo9vsjMwXzJQ