ci: harden workflows per zizmor audit#4643
Merged
Merged
Conversation
resolves zizmor findings on .github/workflows/: - add `persist-credentials: false` to all `actions/checkout` calls; the duty-scheduler push now uses an explicit token URL instead of relying on persisted creds (artipacked) - restructure quantitative tests to the safe two-workflow pattern: the test job moves to `pull_request` (no secrets, read-only token) and a new `quantitative-comment.yaml` posts the result on `workflow_run` with `pull-requests: write`. comment posting uses `gh api` with a marker-based upsert, removing the `thollander/actions-comment-pull-request` third-party dependency. eliminates the `pull_request_target` + PR-head checkout pwn-request antipattern (dangerous-triggers) - add `.github/zizmor.yml` with justified ignores for the remaining safe `pull_request_target` workflows (check-pr-dependencies, check-pr-title — metadata-only, no checkout) and the new `workflow_run`-triggered comment workflow (artifact-only, no PR code execution) zizmor result: no findings reported (3 ignored, 35 suppressed)
Contributor
|
📊 Quantitative test results for language: |
Xhoenix
approved these changes
May 25, 2026
Xhoenix
reviewed
May 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
what
persist-credentials: falseto everyactions/checkoutcall so the defaultGITHUB_TOKENis not persisted into.git/config(artipacked).duty-scheduler.yamlnow pushes via an explicithttps://x-access-token:${GH_TOKEN}@github.com/${REPOSITORY}URL instead of relying on persisted creds.quantitative.yamlto the safe two-workflow pattern. the test job now runs onpull_request(no secrets, read-only token, fork-safe) and writespr_comment.md+ a regex-validatedpr_number.txtto an artifact. a newquantitative-comment.yamltriggers onworkflow_runwithpull-requests: write, downloads the artifact, and upserts the PR comment viagh api(marker<!-- quantitative-tests-comment -->). this eliminates thepull_request_target+ PR-head checkout pwn-request antipattern (dangerous-triggers) and also drops thethollander/actions-comment-pull-requestthird-party dependency.env:to avoid${{ ... }}interpolation insiderun:bodies..github/zizmor.ymlignores the remaining safe findings with justification:check-pr-dependencies.yaml,check-pr-title.yaml—pull_request_targetis the standard pattern here; neither workflow checks out PR code, both consume only PR metadata via pinned actions withpull-requests: read.quantitative-comment.yaml—workflow_runis the privileged half of the safe pattern; it consumes only artifact contents (markdown + numeric PR id) and never executes PR-supplied code.why
zizmorflagged 8 findings on this repo's workflows: 3 high-severitydangerous-triggers(pull_request_target) and 5artipackedwarnings. thequantitative.yamlfinding is genuinely exploitable —pull_request_targetruns with the base repo's secrets andpull-requests: write, and the workflow then checks out${{ github.event.pull_request.head.sha }}and operates on PR-controlled files. switching to thepull_request+workflow_runpattern keeps the same UX (a PR comment with the false-positive diff) while removing fork code from any privileged context.after the changes,
zizmorreports:No findings to report. Good job! (3 ignored, 35 suppressed).refs
ai disclosure
zizmoron.github/workflows/, drafting the safe two-workflow split forquantitative.yaml, writing.github/zizmor.ymlwith per-rule justifications, replacingthollander/actions-comment-pull-requestwith agh api-based marker upsert, looking up theactions/[email protected]SHA via the GitHub API for pinning, drafting this PR description.zizmor .github/workflows/after each change and confirmed final state is clean (3 ignored, 35 suppressed); ranactionlinton all workflow files (no new findings introduced by these changes); confirmed allactions/download-artifactandactions/checkoutSHAs match the documented tags; manually traced thepull_request→workflow_rundata flow to confirm no PR-controlled code executes in the privileged half and that thepr_number.txtartifact is regex-validated (^[0-9]+$) before use ingh apipaths.