build(deps): Pin third-party pre-commit hook revs to commit SHAs - #120642
Open
timhaines wants to merge 1 commit into
Open
build(deps): Pin third-party pre-commit hook revs to commit SHAs#120642timhaines wants to merge 1 commit into
timhaines wants to merge 1 commit into
Conversation
Author
|
@joshuarli tagging you since you did the prek migration in #110808 and the |
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.
I do supply-chain and CI/CD security review. Found this reading public CI configs; nothing commercial behind it.
Four
rev:lines move from a git tag to the commit that tag points at today, with the tag kept in a# frozen:comment. Same repos, same versions, no behaviour change.Why
A tag is a mutable git ref. Whoever controls the hook repo can repoint
v5.0.0at different (potentially malicious) code, and every consumer picks it up on the next environment build. That's what happened totj-actions/changed-filesin 2025, and toaquasecurity/trivy-actionin March 2026 when 76 of its 77 tags were force-pushed to code that scraped credentials off the runner (GHSA-69fq-xp46-6x23). Those are Actions, butuses:andrev:are the same kind of reference.These four repos execute in two places. On every engineer's machine, since
default_install_hook_typesis['pre-commit', 'pre-push']anddevenv syncrunsprek install, so they run on every commit with whatever credentials that laptop is carrying. And inpre-commit lint, one of the five required checks onmaster, which mints a GitHub App token fromSENTRY_INTERNAL_APP_PRIVATE_KEY(pre-commit.yml:34-40), runs the hooks, then commits whatever they modified back to the PR branch with that token (:84-90).Every non-local
uses:under.github/is already SHA-pinned. These fourrev:lines are the exception. cpython, ruff, airflow, jax and flask pin hook revs the same way. No other getsentry repo does, so I'm not asking you to roll this out anywhere else.Tested
Against prek 0.3.6, which is what
uv.lockpins.prek prepare-hooks, which is CI's command and whatdevenv syncruns, from a cleared cache: exit 0. A well-formed but nonexistent SHA fails withfatal: unable to read tree, so that isn't a silent skip.check-jsonschema0.29.3 is an annotated tag, so a plaingit ls-remote refs/tags/0.29.3returns the tag object rather than the commit. The pin is the dereferenced^{}.Also worth doing, separately
uv.lockis on 0.3.6.update --checkas a CI drift gate and impostor-commit detection landed in 0.3.9, andupdate.freezein 0.4.10 makes freezing the default so a strayprek updatecan't quietly un-pin these.cooldown:in.github/dependabot.yml, nominimumReleaseAgein the pnpm block, noexclude-newerunder[tool.uv]. cpython uses 14 days, jax 7, airflow 4. Version updates only, not security updates.prek update --freezewould also move check-jsonschema to 0.37.4, pre-commit-hooks to v6.0.0 and shellcheck-py to v0.11.0.1. I ran all three across the full tree and they pass with nothing modified, but that's a behaviour change and belongs in its own PR.And now the PR template's boilerplate:
Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.