fix(registry): return raw bytes from manifest cache for policy evaluation#58
Merged
Conversation
…tion When manifests were retrieved from the disk cache, the raw bytes were not returned, causing policy verification to fail. The subject.Size was set to 0 because raw was nil, and sigstore verification detected a Content-Length mismatch. This fix modifies the ManifestCache interface to return both the parsed manifest and raw bytes from GetManifest(). The raw bytes are needed for policy evaluation which requires exact original bytes for size calculations. The bug was intermittent because it only triggered when the manifest cache was populated (e.g., inspect followed by verify in the same workflow). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
blob | 564f0f2 | Commit Preview URL Branch Preview URL |
Jan 25 2026, 02:10 AM |
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
ManifestCache.GetManifest()interface to return both parsed manifest and raw bytesProblem
When manifests were retrieved from the disk cache, the raw bytes were not returned. This caused
subject.Sizeto be set to 0 in policy evaluation, leading to sigstore verification failures due to Content-Length mismatch.The bug was intermittent because it only triggered when the manifest cache was populated (e.g.,
inspectfollowed byverifyin the same workflow).Changes
registry/cache/cache.goManifestCacheinterface to return(manifest, raw, ok)registry/cache/disk/cache.goregistry/fetch.goregistry/fetch_test.goregistry/bench_oci_flow_test.goregistry/cache/disk/cache_test.goTest plan
TestClient_Fetch_CacheHitReturnsRawBytesverifies fixjust ci)🤖 Generated with Claude Code