fix: normalise bare SHA BUILDER_REF before refs/tags/ prefix check in builder-fetch.sh#4502
Open
shinagawa-web wants to merge 1 commit intoslsa-framework:mainfrom
Open
fix: normalise bare SHA BUILDER_REF before refs/tags/ prefix check in builder-fetch.sh#4502shinagawa-web wants to merge 1 commit intoslsa-framework:mainfrom
shinagawa-web wants to merge 1 commit intoslsa-framework:mainfrom
Conversation
a639b5c to
32b33da
Compare
Signed-off-by: Kazutomo Deguchi <131741597+shinagawa-web@users.noreply.github.com>
32b33da to
b7ae0b6
Compare
2 tasks
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.
Summary
builder-fetch.shrejects a bare 40-char commit SHA asBUILDER_REFwithexit 2, even though the SHA-resolution path a few lines later is designed to handle exactly that case. This makes the pre-built binary download path (compile-generator: false, the default) fail for every caller that pins the reusable workflow with@<sha>— which is the pinning style the project's own security guidance recommends.Root cause
detect-workflow-jsemits the raw commit SHA when the caller pins the workflow with@<sha>. For example:The current guard at the top of
builder-fetch.sh:rejects the bare SHA before execution reaches the SHA-resolution loop that looks up the matching release tag.
Both v2.0.0 and v2.1.0 are affected.
Fix
Normalise a bare SHA to
refs/tags/<sha>before the prefix check so the existing SHA-resolution loop can resolve it to the correct release tag:This is a minimal, backward-compatible change. The subsequent logic is unchanged: the SHA is resolved to a release tag, the corresponding binary is downloaded, and provenance is verified.
Reproduction
Pin any of the
generator_*_slsa3.ymlreusable workflows with@<sha>(e.g.@f7dd8c54c2067bafc12ca7a55595d5ee9b75204a) and use the defaultcompile-generator: false. TheGenerate builderstep fails immediately with:Test
Verified against
shinagawa-web/gomarklint(public repository, v3 release workflow) where this failure was first observed and diagnosed.