Skip to content

fix(ci): add zizmor scanner and fix workflow security findings#10618

Merged
jasonsaayman merged 3 commits intoaxios:v1.xfrom
shaanmajid:zizmor-fixes
Apr 2, 2026
Merged

fix(ci): add zizmor scanner and fix workflow security findings#10618
jasonsaayman merged 3 commits intoaxios:v1.xfrom
shaanmajid:zizmor-fixes

Conversation

@shaanmajid
Copy link
Copy Markdown
Contributor

@shaanmajid shaanmajid commented Mar 31, 2026

Summary

Adds zizmor as a GitHub Actions security scanner and fixes the issues it flagged. All fixes are low-risk, zero-cost improvements to CI hygiene.

Template injection (deprecate.yml, release-branch.yml)

Routes ${{ github.event.inputs.* }} through env: blocks instead of interpolating directly in run: shells. Both workflows are maintainer-only (workflow_dispatch), so the practical risk was minimal, but the fix is trivial and eliminates the code smell entirely. See zizmor's template-injection docs.

Credential persistence (all workflows)

Sets persist-credentials: false on every actions/checkout step. Risk here was also low, but there's no reason to leave credentials around when no workflow needs them for post-checkout git operations. update-sponsor-block.yml uses peter-evans/create-pull-request@v8, which manages its own credentials and does not depend on checkout's. See zizmor's artipacked docs.

Continuous scanning (zizmor.yml)

New workflow runs zizmor on pushes to v1.x and on PRs, uploading SARIF results to GitHub code scanning.

Exceptions

Two One zizmor rules are is disabled in .github/zizmor.yml since fixing them it here would add noise:


Summary by cubic

Adds zizmor GitHub Actions security scanning and hardens CI by removing template-injection vectors and disabling checkout credential persistence. No changes to build or release behavior.

Description

  • Summary of changes

    • Added .github/workflows/zizmor.yml to run zizmor on pushes to v1.x and on all PRs, uploading SARIF with job-level security-events: write and workflow permissions: {}.
    • Added .github/zizmor.yml with excessive-permissions temporarily disabled.
    • Routed ${{ github.event.inputs.* }} through env in release-branch.yml to prevent shell template injection.
    • Set persist-credentials: false on all actions/checkout steps across workflows.
    • In publish.yml, replaced cache: npm with package-manager-cache: false to avoid unused cache config.
  • Reasoning

    • Prevent template injection in run: shells.
    • Reduce token exposure by not persisting checkout credentials.
  • Additional context

    • update-sponsor-block.yml uses peter-evans/create-pull-request, which manages its own credentials.
    • We'll re-enable the excessive-permissions rule after a permissions audit.

Docs

  • zizmor findings appear under Security > Code scanning alerts.
  • The scanner runs on PRs and on pushes to v1.x.

Testing

  • No application tests; CI-only changes.
  • Verified by running workflows via this PR; workflow_dispatch inputs in release-branch.yml now flow through env.
  • No additional tests needed.

Written for commit 18d24a2. Summary will update on new commits.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 8 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Copy link
Copy Markdown
Member

@jasonsaayman jasonsaayman left a comment

Choose a reason for hiding this comment

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

thanks looks good to me and thanks for adding zizmor

@jasonsaayman
Copy link
Copy Markdown
Member

@shaanmajid could you please rebase

@jasonsaayman jasonsaayman added priority::medium A medium priority commit::ci The PR is related to CI labels Apr 1, 2026
@shaanmajid
Copy link
Copy Markdown
Contributor Author

@jasonsaayman Done. Also removed the unpinned-uses exception since that was addressed by #10627

@github-advanced-security
Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@jasonsaayman jasonsaayman merged commit a04dd96 into axios:v1.x Apr 2, 2026
19 checks passed
@shaanmajid shaanmajid deleted the zizmor-fixes branch April 2, 2026 06:45
@daiyam
Copy link
Copy Markdown

daiyam commented Apr 3, 2026

Hello, after reading #10633, I found out about zizmor and this PR.
I was wondering if zizmor is protected from being deleted by an hacker (with a commit from the hacked dev)?
And how is it stopping publish.yml workflow to be called (with a git tag from the hacked dev)?

@shaanmajid
Copy link
Copy Markdown
Contributor Author

shaanmajid commented Apr 6, 2026

@daiyam

Based off #10636 (comment), it looks like you've already been tinkering with zizmor, so maybe you've answered your own questions by now :-). But in case you haven't:

zizmor isn't a runtime security gate; it's a static analysis linter for GitHub Actions workflow (and related) files, similar to what ESLint is for JavaScript. It scans your workflow YAML for insecure patterns during development (e.g.,unpinned action references, injection-prone expressions, etc.). It runs in CI as a check on PRs so reviwers can catch workflow security issues before they're merged. (zizmor-action, which is used here, also uploads results as SARIF to GitHub's Security tab (Code Scanning alerts), so findings are tracked alongside other security alerts for the repo.)

It doesn't stop a compromised dev from triggering a workflow or pushing a tag; that's not it's job. Gating workflow execution is the job of e.g., branch protection rules and GitHub Environments (required reviewers, branch restrictions, etc.).

(One thing to note if anyone does try to remove the zizmor workflow, it will have to be done publicly via git, so at the very least there's an audit trail.)

And as discussed in #10636, none of these CI-level controls would have prevented this specific attack anyway, since the attacker published directly to the npm registry from the compromised machine without going through CI at all.

@daiyam
Copy link
Copy Markdown

daiyam commented Apr 6, 2026

@shaanmajid Thank you for your reply.

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

Labels

commit::ci The PR is related to CI priority::medium A medium priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants