fix(blob): compare file checksums case-insensitively #5036
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 289 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.339
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #5036"
general
weight: 0.35
semx
Summary
cosign initialize --root-checksumrejects a correct checksum when it is written in upper case.hex.EncodeToStringalways emits lower case, andpkg/blob/load.go:107compares it to the user-supplied value with!=. Hex is case-insensitive, and plenty of sources publish digests in upper case, so a user holding a perfectly good checksum is told it is wrong.Reproducer against the real sigstore root:
The error message gives it away: expected and got are the same digest.
Why this is more than cosmetic
LoadFileOrURLWithChecksumhas exactly one caller,cmd/cosign/cli/initialize/init.go:59, and that is the TUF root of trust. So the person who hits this is doing the right thing: pinning a root they fetched out of band. What the tool tells them is that the root does not match. The nearest way out is--force-skip-checksum-validation, which is exactly the habit this flag exists to prevent.Change
strings.EqualFoldinstead of!=. Wrong checksums stay wrong: aDEADBEEF-prefixed digest is still rejected, and the prefixed forms (sha256:,sha512:) behave the same as before apart from case.Testing
Added upper-case sha256 and sha512 cases to the existing
TestLoadURLWithChecksum. They fail on main and pass with the fix; the existing cases are untouched.go vet ./pkg/blob/,gofmtandgo build ./...are clean.Also ran both binaries end to end against sigstore's
12.root.json:| build | checksum | exit |
|---|---|---|
| main | lower case | 0 |
| main | UPPER CASE | 1 |
| fix | UPPER CASE | 0, initialization completes |
| fix |
sha256:+ UPPER CASE | 0 || fix |
DEADBEEF...| 1, still rejected |Release Note
cosign initialize --root-checksumnow accepts upper-case and mixed-case hex digests.Documentation
NA