Skip to content

Commit 4bbe596

Browse files
authored
Add zizmor workflow security analysis (#505)
1 parent 6d69224 commit 4bbe596

2 files changed

Lines changed: 49 additions & 0 deletions

File tree

.github/workflows/zizmor.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Workflow security analysis with zizmor. Maintainer notes:
2+
# CONTRIBUTING.md#workflow-security-analysis
3+
4+
name: zizmor
5+
6+
on:
7+
push:
8+
branches: [main]
9+
pull_request:
10+
schedule:
11+
- cron: '45 9 * * 5' # weekly: refreshes the online audits' advisory data
12+
workflow_dispatch:
13+
permissions: {}
14+
15+
jobs:
16+
zizmor:
17+
permissions:
18+
contents: read
19+
security-events: write # SARIF upload to code scanning
20+
uses: open-telemetry/shared-workflows/.github/workflows/zizmor.yml@03559ef555db0eae5d85c3c6347d1530243e7aa7 # v0.13.0
21+
with: { persona: pedantic }

CONTRIBUTING.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,38 @@ npm run local -- serve
113113
The `local` prefix runs the script against the sibling Docsy, and the server
114114
watches it, so theme edits hot-reload.
115115

116+
### Workflow security analysis
117+
118+
`.github/workflows/zizmor.yaml` runs [zizmor][] over this repo's workflows in
119+
its pedantic persona (security audits plus workflow hygiene) on every PR, on
120+
pushes to `main`, and weekly, so the online audits catch advisories published
121+
against already-pinned actions. Results upload to the repository's Security tab
122+
as code-scanning alerts.
123+
124+
- The job passes whatever it finds; findings are alerts to triage. Blocking, if
125+
any, would come from a code-scanning rule in a ruleset on `main`.
126+
- The workflow calls the [OpenTelemetry shared workflow][otel-zizmor] at a
127+
pinned commit; that workflow pins the zizmor action, which pins the zizmor
128+
image by digest, so the scanner moves only when the pin here does. Review the
129+
chain at each bump.
130+
- CI-only by design: the repo carries no tooling dependency for it. For a local
131+
run, with `GH_TOKEN` set for the online audits, where _`VERSION`_ is the
132+
zizmor version the workflow's latest run logs (its `zizmor vX.Y.Z` banner):
133+
134+
```bash
135+
uvx zizmor@VERSION --persona=pedantic .
136+
```
137+
138+
- `security-events: write` sits alone in this workflow, away from the job that
139+
installs and builds.
140+
116141
[alternate dashboard]: https://app.netlify.com/sites/goldydocs/deploys
117142
[deploys]: https://app.netlify.com/sites/docsy-example/deploys
118143
[Docsy]: https://github.com/google/docsy
119144
[hugo-extended]: https://www.npmjs.com/package/hugo-extended
120145
[Hugo workspace]: https://gohugo.io/configuration/module/#top-level-settings
146+
[otel-zizmor]:
147+
https://github.com/open-telemetry/shared-workflows/blob/main/zizmor/README.md
148+
[zizmor]: https://docs.zizmor.sh/
121149

122150
<!-- cSpell:ignore hugo docsy -->

0 commit comments

Comments
 (0)