fix: reject manifest PUT whose digest reference doesn't match the content#137
Open
m-ferrero wants to merge 1 commit into
Open
fix: reject manifest PUT whose digest reference doesn't match the content#137m-ferrero wants to merge 1 commit into
m-ferrero wants to merge 1 commit into
Conversation
…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).
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.
Problem
A manifest
PUTaddressed 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.