Skip to content

Commit 3820bb9

Browse files
authored
ci: add zizmor static analysis workflow (#1012)
* ci: add zizmor static analysis for workflows Runs zizmor (https://docs.zizmor.sh) on every PR that touches workflow or zizmor config files, and on every push to main. Findings upload to the Security tab via SARIF; the workflow itself never fails (per zizmor-action's recommended Advanced Security mode -- gate merges with a code scanning ruleset if desired). The zizmor.yml at the repo root ignores a small, deliberately-chosen set of findings: - dangerous-triggers: pull_request_target / workflow_run on the six workflows that use them defensively (don't execute PR code; only inspect metadata or apply pre-vetted artifacts). - excessive-permissions on cla.yml: the third-party CLA assistant action needs the listed scopes; the workflow has one job that uses all of them. Everything else (template-injection, artipacked, secrets-inherit, use-trusted-publishing) stays visible. With the upstream fixes in #1009 applied, the baseline is 0 High / 10 Medium / 13 Informational -- all advisory, all worth surfacing. * ci(zizmor): move config to .github/zizmor.yml, tidy trigger Addresses Copilot review on #1012: - Move zizmor.yml from repo root to .github/zizmor.yml. The workflow's paths filter already pointed at .github/zizmor.yml, and zizmor auto-discovers either location; co-locating with the workflows makes the relationship obvious. - Drop branches: ["**"] on pull_request (default is all base branches). - Drop the zizmor.yml path entry (the config no longer lives there).
1 parent e440b82 commit 3820bb9

2 files changed

Lines changed: 75 additions & 0 deletions

File tree

.github/workflows/zizmor.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: zizmor
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
paths:
8+
- ".github/workflows/**"
9+
- ".github/zizmor.yml"
10+
11+
permissions: {}
12+
13+
jobs:
14+
zizmor:
15+
name: Run zizmor
16+
runs-on: ubuntu-latest
17+
permissions:
18+
security-events: write # upload SARIF to code scanning
19+
contents: read
20+
actions: read
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
24+
with:
25+
persist-credentials: false
26+
27+
- name: Run zizmor
28+
uses: zizmorcore/zizmor-action@b1d7e1fb5de872772f31590499237e7cce841e8e # v0.5.3

.github/zizmor.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Configuration for zizmor (static analysis for GitHub Actions).
2+
# https://docs.zizmor.sh/configuration/
3+
#
4+
# Findings ignored here are *deliberate* design choices, not "TODOs we never
5+
# got to". Anything new or unexpected should land as a finding in the Security
6+
# tab and be triaged before merge. Add an entry here only with a comment
7+
# explaining why the finding is acceptable.
8+
9+
rules:
10+
# `pull_request_target` and `workflow_run` are inherently dangerous, but we
11+
# use them in workflows that have been written defensively: they either
12+
# don't run untrusted code from the PR head, or they isolate untrusted state
13+
# into clearly-marked steps. Each entry below has a one-line justification.
14+
dangerous-triggers:
15+
ignore:
16+
# CLA assistant must comment on PRs from forks; runs a pinned third-party
17+
# action and does not execute any code from the PR.
18+
- cla.yml
19+
# Auto-format runs against trusted same-repo branches only (gated by
20+
# `github.event.pull_request.head.repo.full_name == github.repository`
21+
# downstream). Fork PRs are routed through format-command instead.
22+
- auto-format.yml
23+
# Lunaria only reads localized content and posts a status comment; does
24+
# not execute PR-controlled code.
25+
- lunaria.yml
26+
# pr-compliance and pr-triage only inspect PR metadata (title, labels,
27+
# author) via github-script. They never check out PR code.
28+
- pr-compliance.yml
29+
- pr-triage.yml
30+
# query-counts-apply uses workflow_run to apply snapshot updates that
31+
# were computed in the untrusted `query-counts` workflow. The trusted
32+
# workflow only consumes the artifact JSON, verifies the head SHA, and
33+
# pushes back via an app token. See workflow comments for the full
34+
# threat model.
35+
- query-counts-apply.yml
36+
# query-counts-label labels PRs based on path filters; it does not
37+
# check out PR code.
38+
- query-counts-label.yml
39+
40+
# The CLA assistant action (contributor-assistant/github-action) requires
41+
# write access to actions, contents (cla-signatures branch), issues, PRs,
42+
# and statuses. The workflow has only one job that uses these permissions,
43+
# so workflow-level vs job-level scoping makes no real difference. A future
44+
# PR may split the `label` job to a separate file with narrower permissions.
45+
excessive-permissions:
46+
ignore:
47+
- cla.yml

0 commit comments

Comments
 (0)