pre-commit manager misclassifies bare SHA rev values as versions
#42264
Unanswered
shaanmajid
asked this question in
Request Help
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
How are you running Renovate?
Self-hosted Renovate CLI
Which platform you running Renovate on?
GitHub.com
Which version of Renovate are you using?
43.101.1
Please tell us more about your question or problem
The
pre-commitmanager can produce incorrect lookup results when a.pre-commit-config.yamlentry uses a bare commit SHA inrevwithout a# frozen:comment.In the current code path:
revvalues are extracted ascurrentValue: <sha>under thegithub-tagsdatasource.# frozen:entries are rewritten intocurrentDigest: <sha>pluscurrentValue: <comment version>.github-tagsdoes not define its owndefaultVersioning, so it falls back to Renovate's global default,semver-coerced.semver-coercedusessemver.coerce(), so some bare SHAs are treated as valid versions.The root cause is that
extractDependency()always assignsrevtocurrentValue, and the later regex enrichment only corrects the special# frozen:form. So a bare SHA is passed into normal version lookup, even though it is not a version.For a bare SHA, the downstream behavior depends onwhether
semver.coerce()can derive a version-like value from the string, and on what real tags exist in the repository:0.0.0, Renovate can propose bogus tag-based updates.9.0.0or20.0.0, Renovate can silently no-op because existing tags sort below it.invalid-value.MRE
renovate.json:{ "$schema": "https://docs.renovatebot.com/renovate-schema.json", "pre-commit": { "enabled": true } }.pre-commit-config.yaml:Example outcoms from current behavior:
revsemver.coerce()9f48a48aa91a6040d749ad68ec70907d907a5a7f9.0.00c6edcf1df76b8f52847d4d5a3102c15df4ec64c0.0.0a00caac4f0cec045f7f67d222c3fcd0744285c51nullinvalid-valueExpected behavior
Bare SHA pins without a
# frozen:comment should not enter semver version lookup at all. They do not carry a comparable version, so they should be skipped as something likeskipReason: 'unspecified-version'instead of being emitted ascurrentValue.# frozen:entries should continue to work as they do now, because they provide both:currentValue.currentDigest.Suggested fix
Detect bare 40-character hex SHAs in the
pre-commitextraction path when there is no# frozen:comment, and do not emit them ascurrentValue. Instead, skip them asunspecified-versionso they never enter thegithub-tags+semver-coercedlookup flow.Logs (if relevant)
Logs
Beta Was this translation helpful? Give feedback.
All reactions