Skip to content

Fix CI: resolve all zizmor security audit findings#20

Merged
tsvikas merged 6 commits into
mainfrom
claude/fix-ci-pipeline-M2ZoJ
Apr 8, 2026
Merged

Fix CI: resolve all zizmor security audit findings#20
tsvikas merged 6 commits into
mainfrom
claude/fix-ci-pipeline-M2ZoJ

Conversation

@tsvikas
Copy link
Copy Markdown
Owner

@tsvikas tsvikas commented Apr 8, 2026

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

  • Added zizmor hook to .pre-commit-config.yaml (repo) and .pre-commit-config.yaml.jinja (template)
  • Audits GitHub Actions workflows for security issues (unpinned actions, template injection, excessive permissions, etc.)

Repository workflows (.github/)

  • Pin actions to SHA hashes in uv-tests.yml and dependabot.yml
  • Use static git identity — replace github.actor with template-tester / template-tester@example.com, eliminating the template injection vector entirely
  • Add permissions: contents: read — restrict default GITHUB_TOKEN scope (least-privilege)
  • Add Dependabot cooldown (default-days: 7)

Generated project templates (project_name/)

  • Pin all actions to SHA hashes in ci.yml, weekly-ci.yml, build-and-publish.yml, and deps-update.yml
  • Scope issues: write to job level in weekly-ci.yml instead of workflow level
  • Add Dependabot cooldown to template dependabot.yml
  • Suppress secrets-outside-env for CODECOV_TOKEN — this is a non-sensitive upload token; requiring GitHub Environments would add unnecessary setup burden for generated projects

Findings addressed

Finding Severity Fix
unpinned-uses High Pin all actions to commit SHAs
template-injection High Use static git identity instead of github.actor
excessive-permissions Medium Add explicit permissions block; scope issues: write to jobs
dependabot-cooldown Medium Add cooldown.default-days: 7
secrets-outside-env Medium Inline # zizmor: ignore (deliberate)

https://claude.ai/code/session_013DBSzYMmxuKo9vsjMwXzJQ

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • 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.
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.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

claude added 5 commits April 8, 2026 15:46
- 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
@tsvikas tsvikas force-pushed the claude/fix-ci-pipeline-M2ZoJ branch from 248ca69 to 677eea3 Compare April 8, 2026 15:46
@tsvikas tsvikas changed the title Pin GitHub Actions to commit SHAs and add Dependabot cooldown Fix CI: resolve all zizmor security audit findings Apr 8, 2026
@tsvikas tsvikas changed the base branch from claude/add-zizmor-precommit-wAYc0 to main April 8, 2026 15:47
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
@tsvikas tsvikas merged commit 91149fa into main Apr 8, 2026
5 checks passed
@tsvikas tsvikas deleted the claude/fix-ci-pipeline-M2ZoJ branch April 8, 2026 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants