Skip to content

chore(pre-commit): pin hooks to commit shas - #758

Merged
kruegener merged 2 commits into
mainfrom
chore/pin-pre-commit-hooks
Nov 2, 2026
Merged

kruegener merged 2 commits into
mainfrom
chore/pin-pre-commit-hooks

Conversation

@aig-hannes

Copy link
Copy Markdown
Contributor

What

Pins every hook rev: in .pre-commit-config.yaml to the commit SHA its tag points to today, with the tag as a comment:

rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c  # frozen: v6.0.0

This is the format pre-commit autoupdate --freeze writes. The hooks run the same code as before.

Why

Part of security days: every dependency must be pinned to a lockfile or a SHA. A tag can be moved to other code at any time, and a SHA cannot. Pre-commit hooks run on developer machines and in CI, so a moved tag would run new code there without review.

Renovate's pre-commit manager is not turned on in this repo yet. A change to the org Renovate config will turn it on for all repos. It then reads the # frozen: comment and updates the SHA and the version together, after the org's 14-day minimum release age. Until then, update by hand with pre-commit autoupdate --freeze.

The SHAs were resolved with git ls-remote from each hook repository.

🤖 Generated with Claude Code

@aig-hannes
aig-hannes requested a review from a team as a code owner October 30, 2026 15:34
@ox-security

ox-security Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

OX Security Logo

OX Security reviewed this pull request — nothing to fix.

✔ No issues found

Branch chore/pin-pre-commit-hooks → main

View scan in OX Security →

@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.
see 3 files with indirect coverage changes

aig-hannes and others added 2 commits November 2, 2026 10:35
Pin every hook rev to the commit its tag points to, with the tag in a '# frozen:' comment, the format 'pre-commit autoupdate --freeze' writes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
detect-secrets reports the 40-character commit SHAs in .pre-commit-config.yaml as Hex High Entropy Strings. Add a baseline line filter for rev: lines that hold a bare SHA.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@olivermeyer
olivermeyer force-pushed the chore/pin-pre-commit-hooks branch from d5766b3 to 8ce00c4 Compare November 2, 2026 09:35
@sonarqubecloud

sonarqubecloud Bot commented Nov 2, 2026

Copy link
Copy Markdown

@kruegener
kruegener merged commit f370f00 into main Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants