Skip to content

pre-commit: Add zizmor - #465

Merged
aaronliu0130 merged 1 commit into
developfrom
zizmor
Aug 12, 2026
Merged

pre-commit: Add zizmor#465
aaronliu0130 merged 1 commit into
developfrom
zizmor

Conversation

@cclauss

@cclauss cclauss commented Aug 11, 2026

Copy link
Copy Markdown
Member

https://docs.zizmor.sh -- zizmor is a static analysis tool that can find and fix security issues in common CI/CD setups, including GitHub Actions, Dependabot, and pre-commit.

+    cooldown:
+      default-days: 7

Summary by CodeRabbit

  • Chores
    • Added a seven-day cooldown for automated GitHub Actions dependency updates.
    • Added automated security checks for workflow configuration.
    • Restricted workflow permissions and disabled persisted checkout credentials.
    • Pinned CI and release actions to immutable revisions for consistent builds.
    • Updated package publishing safeguards and related automation configuration.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5ff0a140-36f1-4cf1-8d18-96387d8c6dc4

📥 Commits

Reviewing files that changed from the base of the PR and between 6062bb1 and 7167739.

📒 Files selected for processing (1)
  • .github/workflows/release.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/release.yml

📝 Walkthrough

Walkthrough

Repository automation now applies a seven-day Dependabot cooldown, runs the pinned zizmor hook, disables the excessive-permissions rule, restricts CI permissions, and pins CI and release actions to immutable commit SHAs.

Changes

Repository automation hardening

Layer / File(s) Summary
Automation update controls
.github/dependabot.yml, .pre-commit-config.yaml, zizmor.yml
Dependabot waits seven days before processing GitHub Actions updates. Pre-commit runs zizmor from revision v1.29.0. The zizmor configuration disables the excessive-permissions rule.
CI workflow hardening
.github/workflows/ci.yml
The CI workflow sets empty permissions, disables persisted checkout credentials, and pins checkout and Python setup actions to commit SHAs.
Release workflow action pinning
.github/workflows/release.yml
The release workflow pins artifact, publishing, release, and signing actions to immutable commit SHAs. The commented TestPyPI publishing reference uses the pinned v1.14.2 revision.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the primary change: adding zizmor to the pre-commit configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch zizmor

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.pre-commit-config.yaml:
- Around line 77-80: Update the zizmor hook configuration at rev v1.29.0 to add
a local files override that includes .pre-commit-config.yaml in its audit scope,
while preserving the existing hook id and repository configuration.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e9f9ca41-ec40-436f-8672-cd7e2547244c

📥 Commits

Reviewing files that changed from the base of the PR and between 169933e and 8d3d687.

📒 Files selected for processing (2)
  • .github/dependabot.yml
  • .pre-commit-config.yaml

Comment thread .pre-commit-config.yaml
Comment on lines +77 to +80
- repo: https://github.com/zizmorcore/zizmor-pre-commit
rev: v1.29.0
hooks:
- id: zizmor

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

manifest="$(mktemp)"
trap 'rm -f "$manifest"' EXIT

curl -fsSL \
  'https://raw.githubusercontent.com/zizmorcore/zizmor-pre-commit/v1.29.0/.pre-commit-hooks.yaml' \
  > "$manifest"

grep -n '^files:' "$manifest"
if grep -Eq '\.pre-commit-config\.ya?ml' "$manifest"; then
  echo "The upstream hook now includes pre-commit configuration files."
  exit 1
fi

Repository: cpplint/cpplint

Length of output: 153


🏁 Script executed:

set -u

echo '--- local configuration ---'
sed -n '65,90p' .pre-commit-config.yaml

echo '--- upstream hook manifest ---'
curl -fsSL \
  'https://raw.githubusercontent.com/zizmorcore/zizmor-pre-commit/v1.29.0/.pre-commit-hooks.yaml' \
  | sed -n '1,120p'

Repository: cpplint/cpplint

Length of output: 884


🌐 Web query:

zizmor v1.29.0 supported file types .pre-commit-config.yaml

💡 Result:

In zizmor v1.29.0, experimental support was added for auditing pre-commit inputs, specifically including.pre-commit-config.yaml files and hook definitions [1][2]. When running zizmor, it can automatically infer the input type—such as a workflow, action, Dependabot configuration, or a pre-commit configuration—when reading from standard input [3]. For local directories or repositories, zizmor identifies and collects these auditable inputs automatically, and users can explicitly target or filter these inputs using the --collect=pre-commit option [3]. It is important to distinguish between using zizmor to audit a.pre-commit-config.yaml file and using zizmor itself as a hook within a.pre-commit-config.yaml file. The former refers to zizmor's new ability to analyze the security of pre-commit configurations [1][2], while the latter is a well-established integration where zizmor is installed as a hook in a repository's.pre-commit-config.yaml to run security audits on GitHub Actions workflows [4][5].

Citations:


🏁 Script executed:

set -u

echo '--- v1.29.0 release note ---'
curl -fsSL 'https://raw.githubusercontent.com/zizmorcore/zizmor/v1.29.0/CHANGELOG.md' \
  | grep -in -A8 -B4 'pre-commit' || true

echo '--- usage documentation references ---'
for url in \
  'https://raw.githubusercontent.com/zizmorcore/zizmor/v1.29.0/docs/usage.md' \
  'https://raw.githubusercontent.com/zizmorcore/zizmor/v1.29.0/docs/integrations.md'
do
  echo "URL: $url"
  curl -fsSL "$url" | grep -in -A5 -B5 'pre-commit' || true
done

echo '--- proposed file pattern behavior ---'
python3 - <<'PY'
import re
pattern = r'^(\.github/(workflows/.*|dependabot\.ya?ml)|(?:.*/)?action\.ya?ml|\.pre-commit-config\.ya?ml)$'
for path in [
    ".pre-commit-config.yaml",
    ".github/workflows/ci.yml",
    ".github/dependabot.yml",
    "sub/action.yaml",
    "action.yml",
    ".github/actions/action.yml",
    "README.md",
]:
    print(f"{path}: {bool(re.fullmatch(pattern, path))}")
PY

Repository: cpplint/cpplint

Length of output: 2941


Include .pre-commit-config.yaml in the hook file scope.

The v1.29.0 hook manifest excludes .pre-commit-config.yaml, so pre-commit skips it. zizmor v1.29.0 supports auditing pre-commit configurations. Add a local files override if this PR must audit that configuration.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.pre-commit-config.yaml around lines 77 - 80, Update the zizmor hook
configuration at rev v1.29.0 to add a local files override that includes
.pre-commit-config.yaml in its audit scope, while preserving the existing hook
id and repository configuration.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
.github/workflows/release.yml (1)

117-118: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Pin the commented TestPyPI publisher to a commit SHA.

Line 118 still uses @v1.14.2. If the TODO step is uncommented, it will not match the immutable commit-SHA policy used by the active PyPI step at Line 52. Use the same commit SHA and retain the version comment.

Proposed fix
-    #  uses: pypa/gh-action-pypi-publish@v1.14.2
+    #  uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/release.yml around lines 117 - 118, Update the commented
TestPyPI publisher step to pin its uses reference to the same commit SHA as the
active PyPI publishing step, while retaining the existing v1.14.2 version
comment.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In @.github/workflows/release.yml:
- Around line 117-118: Update the commented TestPyPI publisher step to pin its
uses reference to the same commit SHA as the active PyPI publishing step, while
retaining the existing v1.14.2 version comment.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: bd46d639-79a4-495b-9765-f26f717f3f0d

📥 Commits

Reviewing files that changed from the base of the PR and between 8d3d687 and 487098e.

📒 Files selected for processing (2)
  • .github/workflows/ci.yml
  • .github/workflows/release.yml

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@zizmor.yml`:
- Around line 2-3: Remove the excessive-permissions configuration block from
zizmor.yml so the audit remains enabled; do not disable the complete audit, and
use only a documented targeted ignore for any confirmed false positive.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3f859582-fc40-4ec0-9269-4a7351c52fc4

📥 Commits

Reviewing files that changed from the base of the PR and between 487098e and 6062bb1.

📒 Files selected for processing (1)
  • zizmor.yml

Comment thread zizmor.yml
Comment on lines +2 to +3
excessive-permissions:
disable: true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- zizmor.yml ---'
cat -n zizmor.yml

printf '%s\n' '--- zizmor hook ---'
sed -n '65,90p' .pre-commit-config.yaml

printf '%s\n' '--- local zizmor references ---'
rg -n -i 'excessive-permissions|zizmor' . --glob '!node_modules' --glob '!dist' --glob '!build' | head -200

Repository: cpplint/cpplint

Length of output: 687


🌐 Web query:

zizmor v1.29.0 configuration rules disable excessive-permissions audit documentation

💡 Result:

In zizmor v1.29.0, you can disable the excessive-permissions audit by modifying your zizmor configuration file (typically zizmor.yml) to set the disable property to true for that specific rule [1][2]. To disable the audit, add the following to your configuration file: rules: excessive-permissions: disable: true The zizmor documentation emphasizes that disabling audits should be used as a measure of last resort, as disabled rules will not appear in ignored or suppressed finding counts, which may lead to missing important future findings [1][2]. Before disabling the audit entirely, the developers recommend considering these alternatives [1][2]: 1. Ignoring specific findings using the rules..ignore configuration [1][2]. 2. Adjusting your persona (e.g., removing --persona=pedantic or --persona=auditor) if you are currently using a more sensitive persona [1][2]. Configuration files can be placed where zizmor discovers them automatically or passed explicitly using the --config flag or the ZIZMOR_CONFIG environment variable [3][4].

Citations:


Keep the excessive-permissions audit enabled.

disable: true disables the complete audit. Remove this block. If a finding is a confirmed false positive, use a documented, targeted ignore instead.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@zizmor.yml` around lines 2 - 3, Remove the excessive-permissions
configuration block from zizmor.yml so the audit remains enabled; do not disable
the complete audit, and use only a documented targeted ignore for any confirmed
false positive.

@cclauss cclauss added enhancement tests dependencies Pull requests that update a dependency file github_actions Pull requests that update GitHub Actions code labels Aug 11, 2026

@aaronliu0130 aaronliu0130 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Wonderful tool! pre-commit does seem like the right place to add this. I don't like the configuration we used though.

I feel like excessive permissions should definitely be checked for and resolved, while I"m unconvinced about pinning hashes: the latter seems like too much labor for little benefit. (Think Manjaro:) Always using an old version prevents auto-updating to a newer patched version in the same major release. Remember that we're not pinning to a specific release, but the same major version number. Since we're only using widely used actions, a security patch release within the same major version from either the authors or GitHub would always be present in the "version contains a supply-chain attack" threat model we're thinking of. Restricting permissions is a far easier and efficacious way of defending against actions maliciously doing more than they're supposed to—

Comment thread zizmor.yml
Comment on lines +2 to +3
excessive-permissions:
disable: true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

—so this is the only change I ask for.

Suggested change
excessive-permissions:
disable: true
unpinned-uses:
config:
policies:
"*": ref-pin

It's not as precise as I'd want it to be (allow v6 but not v6.1.0), but it'll do.

@cclauss

cclauss commented Aug 12, 2026

Copy link
Copy Markdown
Member Author

GitHub Actions Session (Maintainer Summit Re-cap)

https://github.com/community/maintainers/discussions/827#discussioncomment-17983486

Immediate Actions hardening advice shared during the session

  1. Always pin actions to a SHA.

@cclauss

cclauss commented Aug 12, 2026

Copy link
Copy Markdown
Member Author

Can I just say that you are incredibly slow at understanding the value of incrementalism. This steady forward progress is the superpower of collaborative open source development. If this pull request is solid forward progress then review it and merge it so we have guardrails in place.

if you have confidence and experience in dealing with excessive permissions then fix the config after this pull request is merged. I have made regrettable errors trying to fix excessive permissions so I am reluctant to fix them in this pull request which does other useful things.

Solving 95% of the problem and getting it merged is better than waiting an extra 2 weeks without any guardrails in place for a 100% solution.

@cclauss
cclauss requested a review from aaronliu0130 August 12, 2026 21:21
@aaronliu0130

Copy link
Copy Markdown
Member

The link you gave was dead and I couldn't find any reference to it.

You do make a very good argument that this makes the security better than before and thus theoretically could prevent a lot of attacks if merged sooner than later. I do have quite a bit more thoughts on incrementalism when applied to every other area, and I'll type them out, but I'll merge this now. I think this conversation is important to have, and I'm glad we'll have an opportunity to discuss it :D

@aaronliu0130
aaronliu0130 merged commit bd2ed38 into develop Aug 12, 2026
12 checks passed
@cclauss
cclauss deleted the zizmor branch August 12, 2026 21:57
@aaronliu0130

Copy link
Copy Markdown
Member

When applied to things that don't prevent more security issues, incrementalism has these problems:

  • The premise is solid forward progress.
    • The reason PRs get changes requested is because they're not solid.
  • It assumes that time delays incur enough damage to offset any gains of making the PR solid.
    • The difference between "merge now and fix later" and "fix now and then merge" is the time at which the merge happens. The release date still happens, and the same code is still shipped; any pending fixes that stop a PR from merging would still need to ship by release. (I shouldn't block a PR otherwise.) There isn't a difference in output, except . A PR not being merged doesn't prevent the open-source community from working on it and harnessing incrementalism like you said.
      • Security changes are the exception when merging earlier would've prevented more attacks. They are indeed critical, and thank you for pointing that out.

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

Labels

dependencies Pull requests that update a dependency file enhancement github_actions Pull requests that update GitHub Actions code tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants