Repository navigation
fix: return DIGEST_INVALID for malformed manifest references - #5114
Merged
milosgajdos merged 1 commit intoNov 29, 2026
Merged
Conversation
milosgajdos
reviewed
Nov 28, 2026
Member
|
@perfloop-agent squash your commits, please |
Manifest verification can return invalid-format, invalid-length, and unsupported-algorithm digest errors. Map all three to DIGEST_INVALID so malformed references receive HTTP 400 instead of duplicate UNKNOWN errors and HTTP 500. Preserve the accompanying missing-reference errors. Wrap parse errors from stored blob links with storage context and retain their cause, keeping damaged registry metadata on the HTTP 500 path. Cover all three validation errors across OCI indexes, Docker manifest lists, OCI image manifests, and Docker schema-2 manifests, and check the wrapped stored-link cause. Signed-off-by: Perfloop Agent <[email protected]>
perfloop
Bot
force-pushed
the
perfloop-pr-open-ejv4qtvm0g
branch
from
November 29, 2026 17:25
da7f8d0 to
dc5b47f
Compare
Contributor
Author
|
Squashed the pull request into one commit without changing the code or tests. |
milosgajdos
approved these changes
Nov 29, 2026
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.
Manifest uploads with a child digest of the wrong length or an unsupported algorithm currently return HTTP 500 with duplicate UNKNOWN errors. Return HTTP 400 DIGEST_INVALID for these inputs instead, matching the existing handling of malformed digest syntax.
In
registry/handlers/manifests.go, handle the three go-digest validation errors together. Keep the accompanying MANIFEST_BLOB_UNKNOWN entries and leave other verification-error mappings unchanged. This changes response translation, not which references are checked: references excluded by validation configuration remain excluded.Wrap parse errors in
readlinkinregistry/storage/blobstore.gowith "invalid digest in stored blob link" and retain the cause. A valid uploaded reference pointing to a damaged registry link then returns HTTP 500 UNKNOWN, rather than blaming the client with DIGEST_INVALID. Driver read errors remain unchanged.The regression test in
registry/handlers/api_test.gocovers malformed syntax, invalid length, and an unsupported algorithm across OCI indexes, Docker manifest lists, OCI image manifests, and Docker schema-2 manifests. It checks the HTTP status and limits the returned error codes to DIGEST_INVALID and MANIFEST_BLOB_UNKNOWN, rejecting spurious UNKNOWN entries. A second HTTP test covers malformed stored links across the same media types;registry/storage/blobstore_test.gochecks the wrapped cause.The focused Go tests for manifest responses, link-error wrapping, tag lookups, enumeration, and manifest storage passed. Scoped golangci-lint validation reported no issues.
AI assisted with this change.
Case and evidence
Made by Perfloop. Human sponsor: Tomás Senart.