-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
spec: Clarify Referrers Tag Schema vs. alternative algorithms #563
Merged
sudo-bmitch
merged 1 commit into
opencontainers:main
from
wking:clarify-referrer-tag-vs-digest-algorithm
Feb 20, 2025
+9
−6
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There have been two main debates associated with this pull request:
sha512
?". I'm starting this new thread to collect that discussion in one place, without spreading it around and interleaving with other discussion.sha512
and other algorithms, what should the tag for a given digest actually be?", which is getting hashed out in this prior thread.Arguments in favor of not declaring Referrers Tag Schema tags for
sha512
and other algorithms seem to mostly point out that the Referrers Tag Schema only comes up in 1.1.0 as a fallback for 404ing Referrers APIs. In registries that support the Referrers API, there is no need for the Referrers Tag Schema.So the motivation for
sha512
and other non-sha256
algorithm support in Referrers Tag Schema would be allowing distribution-spec 1.1.2 (or whatever) compatible clients to interact with a registry that does not support the Referrers Tag Schema, but where the client might plausibly want to look up referrers to asha512:...
resource. Increasing the odds is this registry constraint:I'm not clear on the scope of "initially" there; maybe it means that the registry is allowed to prune such referring manifests after some time if it feels like the referenced manifest has not appeared? But let's do some testing with a real registry!
Setting up some auth:
Building an example manifest using the empty descriptor so we have something to refer to:
Pushing the empty
{}
blob to my test repository on the production Quay.io:Pushing that manifest to my test repository on the production Quay.io:
That's the current Quay saying "we expect you'll be wanting to reference this manifest via
sha256
...". But we have our own opinions! Let's create a second manifest to reference the first viasha512
:And pushing that too:
Quay did not respond with the
OCI-Subject
header, and we did havesubject
set, so to be compliant with the 1.1.0 spec, mycurl
-based distribution-spec client MUST:Here's my image index:
And pushing that index:
So success, it's working today, against a production registry, and I do need the clarity on how to map the
sha512:3e28...
subject
to a Referrers Tag that this pull is trying to deliver.#543 is in flight asking registries of the future to be able to return
Docker-Content-Digest
for manifests with manifest-pusher-requested hash algorithms. But you don't need that to make the Referrer Tag system useful forsha512
and other algorithms. Perhaps you have a system like the OpenShift Update Service, tags on your referenced resource are just a way to keep the registry from garbage collecting that image, and you're passing around by-digest references with your custom system:If a by-digest system like that tells me that I am interested in
quay.io/wking-red-hat/test@sha512:3e28ec27b08b5454f3fb07d8eb255be177dfeb6810947b3fe0b6099d6eb3f6d08d4a28cd6128a1d5bb12851c0037f8a72653a11342dbea6d52851571fbbe7017
, and I want to pull referrers, I first check the Referrers API:The current spec doesn't require me to fail out on that 400, so I can fall back to this pull request's Referrers Tag Schema to map to
sha512-3e28ec27b08b5454f3fb07d8eb255be177dfeb6810947b3fe0b6099d6eb3f6d0
and pull:So all I needed to make this commit useful for referencing manifests
sha512:...
vs. the current Quay.io implementation was "if the Referrers API 400s you, also fall back to the Referrers Tag schema, just in case". Which seems like not a terrible stretch for future clients trying to work compatibly with older/existing registries, right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, without the subject manifest, a registry that supports referrers could make a GC policy that prunes these just like they prune blobs if a manifest referencing the blob isn't pushed after the blob is pushed.
In your example, can you pull the tagged image by the sha512 digest? Would a client that is pulling the tag have a way to discover the referrers to that manifest if it queries the digest the registry (using a HEAD request on the tag)? How do clients know when to fetch referrers with a different algorithm than the registry defaults to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, nope, current Quay rejects that:
That's the external by-digest reference system, like the OpenShift Update Service in my previous comment. But good point about the registry not supporting by-
sha512
-digest manifest retrieval. So to make it work, you'd need the external by-digest reference system to transmit bothsha512
or whatever (if the users have a digest algorithm they prefer for security reasons) digests and alsosha256
digests, to support looking up the referenced manifest in legacy registries that didn't supportsha512
yet. Not impossible, but less likely than if registries did supportsha512
digest retrieval for manifests.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so pivoting to "could there be future registries that support
sha512
but not support the Referrers API?". I can't speak to any established registries, so if there's room for linking those together with a MUST in #543, that's fine with me. I think it would be still worth adding language to restrict the Referrers Tag Schema tosha256
, if we go that path. Because of restrictions set onsha256
the text could just be something like:without having to talk about truncation or anything else.
But from the 1.1.0 spec:
So it seems like it's currently possible to have a 1.1-compliant registry that does not support the referrers API, as long as you do not claim conformance with Content Discovery. Which would make "how do Referrers Tags work for
sha512
?" a useful question to answer for clients interacting with registries that implement the ability to pull manifests bysha512
digests under the Pull category, but chose not to implement the Referrers API in the Content Discovery category. Will any registries make that set of choices when implementing? I have no idea. No worries if you want to leave the current ambiguous Referrers Tag wording in place until there is an actual registry who makes that choice, although that would mean that clients might have to scramble to align with whatever Referrer Tag Schema is selected at that point.