Skip to content

fix: reject manifest PUT whose digest reference doesn't match the content#137

Open
m-ferrero wants to merge 1 commit into
cloudflare:mainfrom
aggrega-ai:fix/manifest-digest-validation
Open

fix: reject manifest PUT whose digest reference doesn't match the content#137
m-ferrero wants to merge 1 commit into
cloudflare:mainfrom
aggrega-ai:fix/manifest-digest-validation

Conversation

@m-ferrero

Copy link
Copy Markdown

Problem

A manifest PUT addressed by digest (the reference contains :) is stored even when the submitted content does not hash to that digest, or when the reference is a malformed digest. The spec requires rejecting a digest/content mismatch.

Solution

When the reference is a digest and the content digest differs from it, return 400 DIGEST_INVALID (distinguishing a malformed digest reference from a genuine content mismatch in the message) instead of storing the manifest under the wrong key.

Tests

Adds cases for a matching by-digest PUT (accepted), a mismatched one (400), and a malformed digest reference (400).

Part of #134.

…ntent

A reference containing ":" addresses a manifest by digest; the submitted content must hash to
exactly that digest. Previously a mismatched or malformed digest reference was stored as a tag
under the wrong key (the content checksum still matched), returning 201 instead of 400. Now returns
400 DIGEST_INVALID. Adds regression tests (mismatched digest, malformed digest, correct digest).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant