Skip to content

ci: Pin pre-commit hooks to commit SHAs - #180

Merged
armenzg merged 1 commit into
mainfrom
ci/pin-pre-commit-hooks
Nov 19, 2026
Merged

armenzg merged 1 commit into
mainfrom
ci/pin-pre-commit-hooks

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Category: CI / workflow hardening (supply chain). No outstanding application security, runtime dependency, or build/deploy issue was found, so this is the top remaining item.

Severity: low.

Issue: .pre-commit-config.yaml referenced all six hook repos by mutable tags (23.12.1, v4.2.0, …). pre-commit fetches and runs that code on contributors' machines and in CI, so anyone who can move one of those tags upstream (compromised maintainer account, force-pushed tag) could run arbitrary code there.

Fix: pin each hook rev to the commit SHA its current tag points to, with a # frozen: <tag> comment so pre-commit autoupdate --freeze keeps working. The hook versions do not change. Pinned hooks:

  • psf/black 23.12.1 → ec91a2be
  • python-jsonschema/check-jsonschema 0.17.1 → 07319853
  • pre-commit/pre-commit-hooks v4.2.0 → db7346d3
  • asottile/reorder_python_imports v3.19.0 → 46907333
  • asottile/pyupgrade v3.22.0 → f22ea065
  • zizmorcore/zizmor-pre-commit v1.32.0 → 06a39750

Each SHA matches what git ls-remote returns for that tag (peeled for annotated tags).

via @armenzg.

--

View Session [Sentry]

@armenzg
armenzg marked this pull request as ready for review November 19, 2026 13:42
@armenzg
armenzg requested a review from a team as a code owner November 19, 2026 13:42
@sentry-junior
sentry-junior Bot requested a review from armenzg November 19, 2026 13:42
@armenzg
armenzg merged commit 35f7268 into main Nov 19, 2026
17 checks passed
@armenzg
armenzg deleted the ci/pin-pre-commit-hooks branch November 19, 2026 13:43
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.

1 participant