Skip to content

feat(ci): add zizmor static analysis for Actions/workflows - #5016

Open
dgershman wants to merge 1 commit into
mainfrom
feature/zarf-4849-static-analysis-actions
Open

feat(ci): add zizmor static analysis for Actions/workflows#5016
dgershman wants to merge 1 commit into
mainfrom
feature/zarf-4849-static-analysis-actions

Conversation

@dgershman

Copy link
Copy Markdown
Contributor

Closes #4849

What

Integrates zizmor as static analysis for GitHub Actions and workflows, giving the project a deterministic source of truth for new supply-chain/CI findings — both on change and on a periodic schedule, as the issue requested.

.github/workflows/scan-zizmor.yml (new)

  • Follows the existing scan-*.yml convention: triggers on pull_request, merge_group, push to main, and a weekly schedule (Mon 04:27 UTC, clear of the CodeQL/Scorecard slots).
  • Uploads SARIF to the code-scanning dashboard on push/schedule. Upload is skipped on pull_request because forked-PR tokens are read-only and cannot write security events — the same reason scorecard.yaml avoids pull_request. The dashboard stays current via push-to-main and the weekly run.
  • zizmor is pinned to v1.26.1 (run via pipx run), mirroring how scan-lint.yml pins golangci-lint by version. No new third-party action is introduced — it reuses the actions/checkout and github/codeql-action/upload-sarif SHAs already in the repo.
  • Advisory for now (continue-on-error): see below.

test-import.yaml (fix)

Remediates the one genuinely attacker-controllable finding so it doesn't land in the dashboard backlog: the workflow interpolated github.event.pull_request.head.repo.full_name (a forked-PR repo name) directly into a run: block (template-injection, High/High). Moved it into the existing env: block as HEAD_REPO and referenced it as a shell variable — the exact indirection the file already uses for COMMIT_SHA. Behavior is unchanged.

Why advisory first

The maintainer asked to remediate findings highest-severity-first across multiple PRs, and noted: "once the current findings are remediated then I think CI makes a good case."

A baseline run (zizmor v1.26.1, .github/) surfaces 12 remaining High findings after this PR's fix — several in release-critical workflows:

Audit Count Notes
template-injection 6 inputs.* / github.actor in nightly-eks.yml, nightly-release.yaml, release.yml, packages/action.yaml — safe env-indirection fixes
github-app 2 release-please.yml, release.ymlcreate-github-app-token w/o scoped permission-*; the second scopes a cross-repo homebrew-tap token used by GoReleaser (only verifiable at release time)
cache-poisoning 4 Low confidence; setup-go caching in release/publish workflows

(plus ~38 Medium and 1 Low, mostly artipacked/excessive-permissions).

Rather than land a large, release-risky diff in one go, this PR establishes the scanner + dashboard now and does not block merges. The remaining findings are visible in code scanning and will be remediated in severity-ordered follow-up PRs, each with reasoning about impact. Once the backlog is cleared, dropping continue-on-error from the run step turns this into a merge gate.

Verification

Run locally with the same pinned version:

pipx run zizmor==1.26.1 .github/                       # full report
pipx run zizmor==1.26.1 --format sarif .github/ > z.sarif   # SARIF (valid 2.1.0)
  • scan-zizmor.yml is itself clean under zizmor (sets persist-credentials: false).
  • test-import.yaml no longer reports template-injection; the go.mod replace directive expands to the identical string.

@dgershman
dgershman requested review from a team as code owners June 29, 2026 16:28
@netlify

netlify Bot commented Jun 29, 2026

Copy link
Copy Markdown

Deploy Preview for zarf-docs canceled.

Name Link
🔨 Latest commit cf5baaa
🔍 Latest deploy log https://app.netlify.com/projects/zarf-docs/deploys/6a429d9fef95b200087de2a1

Integrate zizmor (https://github.com/zizmorcore/zizmor) as a static-analysis
scan for GitHub Actions and workflows, addressing #4849.

New `.github/workflows/scan-zizmor.yml` follows the existing `scan-*.yml`
convention: it runs on pull_request, merge_group, push to main, and weekly
(Mon 04:27 UTC). It uploads SARIF to the code-scanning dashboard on push and
schedule (skipped on pull_request, since forked-PR tokens cannot write
security events — mirroring scorecard.yaml), giving a deterministic source of
truth for new findings.

The scan is advisory for now (`continue-on-error`): the repo has a backlog of
existing findings — several in release-critical workflows — that will be
remediated in severity-ordered follow-up PRs, per the maintainer's guidance on
#4849 ("once the current findings are remediated then I think CI makes a good
case"). Once the backlog is cleared, dropping `continue-on-error` turns this
into a merge gate.

Also remediates the one genuinely attacker-controllable finding so it does not
reach the dashboard backlog: `test-import.yaml` interpolated
`github.event.pull_request.head.repo.full_name` (a forked-PR repo name)
directly into a `run:` block. Moved it into the existing `env:` block as
`HEAD_REPO` and reference it as a shell variable — the same indirection the
file already uses for `COMMIT_SHA`. Behavior is unchanged.

zizmor is pinned to v1.26.1 (run via `pipx run`), mirroring how scan-lint.yml
pins golangci-lint by version.

Crow-Session: 7E0394B6-437C-46EA-9755-1C9F01CF7E72
Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Danny Gershman <danny.gershman@gmail.com>
@dgershman
dgershman force-pushed the feature/zarf-4849-static-analysis-actions branch from 286b76e to cf5baaa Compare June 29, 2026 16:30
@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Integrate static analysis of actions/workflows

2 participants