Skip to content

Add zizmor GitHub Actions static analysis - #148

Merged
blarghmatey merged 3 commits into
mainfrom
add-zizmor-security
Aug 6, 2026
Merged

Add zizmor GitHub Actions static analysis#148
blarghmatey merged 3 commits into
mainfrom
add-zizmor-security

Conversation

@blarghmatey

Copy link
Copy Markdown
Member

What are the relevant tickets?

N/A

Description (What does it do?)

Hardens the supply-chain security posture of this repo's GitHub Actions workflows by adding zizmor, a static analysis tool for GitHub Actions YAML that catches issues like script injection via untrusted input, overly broad permissions: blocks, unpinned/mutable action references, and other common workflow misconfigurations. Mirrors the pattern already rolled out to mitodl/mit-learn, mitodl/ol-django, mitodl/ol-keycloak, and others.

  1. New CI workflow.github/workflows/actions-static-analysis.yml runs zizmor via zizmorcore/zizmor-action (pinned to v0.6.2 by commit SHA) on push to anything under .github/workflows/**. It scans .github/workflows/ and fails on findings at high severity / medium confidence or above. The workflow itself follows least-privilege practice: top-level permissions: {} with only contents: read and actions: read granted to the job, and the checkout step uses persist-credentials: false.

  2. New pre-commit hook.pre-commit-config.yaml gains a zizmorcore/zizmor-pre-commit entry (pinned to v1.29.0) using the zizmor hook ID, so contributors get the same linting feedback locally before pushing, not just in CI.

  3. Existing workflows fixed — ran zizmor --fix=all against this repo's pre-existing workflow files, which auto-applies zizmor's safe fixes (pinning unpinned action refs to commit SHAs, adding persist-credentials: false). This cleared every high-severity finding zizmor reports against this repo. Remaining findings are medium severity or below and don't trip the new workflow's min-severity: high gate.

Screenshots (if appropriate):

N/A - no UI changes.

How can this be tested?

  • Review .github/workflows/actions-static-analysis.yml directly — confirm it only triggers on changes under .github/workflows/**, uses SHA-pinned action references, and grants the job only contents: read and actions: read.
  • After merge, the new "GitHub Actions Static Analysis" check will run automatically on any future PR that touches workflow YAML.
  • The action-ref pin changes in existing workflows are behavior-preserving: each pinned SHA was verified to be the exact commit the previous mutable ref (tag or branch) currently resolves to.

Additional Context

Part of an org-wide zizmor rollout; this repo was in the first wave, scoped to repos with GitHub Actions workflows that had the most recent push activity.

Also applies zizmor --fix=all to existing workflows: pins previously
unpinned/mutable action refs to commit SHAs and adds persist-credentials:
false to checkout steps, clearing every pre-existing high-severity finding.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings August 5, 2026 16:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The missing pull-request trigger leaves workflow changes from forks untested.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Pull request overview

Adds zizmor-based static analysis to harden GitHub Actions security.

Changes:

  • Adds CI and pre-commit zizmor checks.
  • Disables persisted checkout credentials across workflows.
  • Pins and documents action versions.
File summaries
File Description
.pre-commit-config.yaml Adds the zizmor hook.
.github/workflows/actions-static-analysis.yml Adds workflow security analysis.
.github/workflows/ci.yml Hardens checkout credentials.
.github/workflows/canary.yml Hardens checkout credentials.
.github/workflows/plugin-compat.yml Hardens both checkout steps.
.github/workflows/settings-verify.yml Hardens both checkout steps.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 1
  • Review effort level: Balanced

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

Comment thread .github/workflows/actions-static-analysis.yml Outdated
blarghmatey and others added 2 commits August 5, 2026 12:48
…h to main

Bot reviewers (Copilot, Sentry) correctly flagged that a push-only trigger
misses fork-based PRs and can't act as a required merge-gate status check.
Scoping push to the default branch avoids the original double-run problem
(push firing on every commit to a same-repo PR branch, redundant with
pull_request) while restoring PR-gate coverage.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ings

- Added `permissions: contents: read` to the fast-checks job in ci.yml.
  The job only checks out code and runs ruff/mypy/pytest/pre-commit
  checks — no writes anywhere, so read-only contents access is
  sufficient.
- Lowered min-severity from high to medium in
  actions-static-analysis.yml and in the zizmor pre-commit hook args in
  .pre-commit-config.yaml, now that the medium-severity finding above is
  fixed.
- yamlfmt reformatted the zizmor hook block indentation in
  .pre-commit-config.yaml as part of the pre-commit run (no semantic
  change).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@blarghmatey
blarghmatey merged commit df917f9 into main Aug 6, 2026
13 checks passed
@blarghmatey
blarghmatey deleted the add-zizmor-security branch August 6, 2026 12:23
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