Skip to content

Fix 500s from malformed manifest digests and out-of-order final chunk PUTs - #4945

Merged
milosgajdos merged 1 commit into
distribution:mainfrom
tianon-sso:conformance
Aug 31, 2026
Merged

Fix 500s from malformed manifest digests and out-of-order final chunk PUTs#4945
milosgajdos merged 1 commit into
distribution:mainfrom
tianon-sso:conformance

Conversation

@tianon

@tianon tianon commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

registry/handlers/blobupload.go: PutBlobUploadComplete never validated Content-Range contiguity on the final chunked-upload PUT, so an out-of-order last chunk fell through to digest validation and returned 400 instead of the spec-mandated 416. d7a2b14 ("add content range handling in patch blob") added this contiguity check to PatchBlobData but never extended it to the PUT completion path, so this reuses the same check there.

registry/handlers/manifests.go: manifestDispatcher silently treated any reference containing : that failed digest.Parse as a tag name, so a malformed digest reference (such as sha256:baddigeststring) reached the tag-based storage path and produced a 500 from an invalid filesystem path instead of a clean 400. Reject it as ErrorCodeDigestInvalid before the tag fallback instead.

Verified against the OCI distribution-spec conformance suite -- the three previously-failing tests (chunked out-of-order + put chunk, invalid-digest-format manifest-put, invalid-digest-format manifest-get) now pass; 779 pass / 6 skip / 4 disabled / 0 fail out of 789 total.

Related work:

Assisted-By: "claude my eyes right out"

@milosgajdos

Copy link
Copy Markdown
Member

DCO isnt signed 😬

… PUTs

`registry/handlers/blobupload.go`: `PutBlobUploadComplete` never validated `Content-Range` contiguity on the final chunked-upload PUT, so an out-of-order last chunk fell through to digest validation and returned 400 instead of the spec-mandated 416.  d7a2b14 ("add content range handling in patch blob") added this contiguity check to `PatchBlobData` but never extended it to the PUT completion path, so this reuses the same check there.

`registry/handlers/manifests.go`: `manifestDispatcher` silently treated any reference containing `:` that failed `digest.Parse` as a tag name, so a malformed digest reference (such as `sha256:baddigeststring`) reached the tag-based storage path and produced a 500 from an invalid filesystem path instead of a clean 400.  Reject it as `ErrorCodeDigestInvalid` before the tag fallback instead.

Verified against the OCI distribution-spec conformance suite -- the three previously-failing tests (chunked out-of-order + put chunk, invalid-digest-format manifest-put, invalid-digest-format manifest-get) now pass; 779 pass / 6 skip / 4 disabled / 0 fail out of 789 total.

Assisted-By: "claude my eyes right out"
Co-Authored-By: Tianon Gravi <admwiggin@gmail.com>
Signed-off-by: Tianon Gravi <tianon.gravi@docker.com>
@tianon

tianon commented Aug 29, 2026

Copy link
Copy Markdown
Contributor Author

Real amateur hours at Tianon's house today 😭

Fixed!

@milosgajdos milosgajdos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, PTAL @thaJeztah

@thaJeztah thaJeztah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thx!

@milosgajdos
milosgajdos merged commit 5b354e6 into distribution:main Aug 31, 2026
21 checks passed
@tianon
tianon deleted the conformance branch August 31, 2026 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants