Skip to content
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

Manifest list should not be identified by HTTP headers #390

Closed
aecolley opened this issue Oct 16, 2016 · 3 comments
Closed

Manifest list should not be identified by HTTP headers #390

aecolley opened this issue Oct 16, 2016 · 3 comments

Comments

@aecolley
Copy link

The manifest-list spec says:

A client will distinguish a manifest list from an image manifest based on the Content-Type returned in the HTTP response.

This is incorrect. A client will always discover a manifest list by following a descriptor in the refs/ directory, and the descriptor will state the media type. The media type will unambiguously distinguish manifests from manifest lists. No part of the spec requires obtaining a manifest/manifest list over HTTP.

In the event that a manifest list is obtained over HTTP, any mismatch between the Content-Type in the HTTP response header and the mediaType in the corresponding descriptor should be resolved in the spec rather than being implementation-defined. I suggest that the descriptor's mediaType should win.

@wking
Copy link
Contributor

wking commented Oct 16, 2016

On Sat, Oct 15, 2016 at 05:09:41PM -0700, Adrian Colley wrote:

The manifest-list spec says:

A client will distinguish a manifest list from an image manifest
based on the Content-Type returned in the HTTP response.

This is incorrect. A client will always discover a manifest list by
following a descriptor in the refs/ directory, and the descriptor
will state the media type. The media type will unambiguously
distinguish manifests from manifest lists. No part of the spec
requires obtaining a manifest/manifest list over HTTP.

“will always discover … by following a descriptor” is too strict the
other way ;). Let's just drop the line about how folks get a
manifest-list (since they can get it any number of ways). In most
cases, folks will know (from a Content-Type header, a descriptor media
type, or other means) what type of blob they're dealing with before
they look at the blob.

In the event that a manifest list is obtained over HTTP, any
mismatch between the Content-Type in the HTTP response header and
the mediaType in the corresponding descriptor should be resolved
in the spec rather than being implementation-defined. I suggest that
the descriptor's mediaType should win.

I think it's less absolute. If you can verify the digest, ignore
Content-Type (this sounds like what you're suggesting here). If you
can't verify the digest, respect the Content-Type and require it to
match your expected media type (if any).

As an example of the “can't verify the digest” case, you could have an
HTTP interface like Docker's 1 with name-based references to
non-descriptor content. Requesters know they're asking for a
manifest, and can ask for a specific type, but they should check the
Content-Type to make sure the registry was able to fulfill their
request (or maybe they're happy with any manifest type and didn't set
Accept, in which case trusting Content-Type is probably their only
option).

And regardless of how you determine the content type, I'd recommend we
allow consumers to die if they don't have a media type by the time
they'd be parsing the blob. If clients want to look inside the blob
and try to guess its type (e.g. by unmarshalling into Versioned 2),
they can do that. But I don't think we should require anyone to look
inside the blob to figure out what it is (and I don't think we
currenly require this, but the presense of Versioned hints in this
direction).

@aecolley
Copy link
Author

Yes, @wking is correct. I was wrong when I said that manifests were reached only through refs/. I still think that the spec should not assume that the manifest is obtained over HTTP.

Other than the sentence that mentions HTTP headers (quoted above), the spec does not attempt to resolve conflicts between media types, and this is fine.

wking added a commit to wking/image-spec that referenced this issue Oct 17, 2016
As Adrian Colley points out [1], clients may not be aquiring the
manifest over HTTP.  In most cases, folks will know (from a
Content-Type header, a descriptor media type, or other means) what
type of blob they're dealing with before they look at the blob.  I
expect client behavior like [2]:

  If you can verify the digest, ignore Content-Type (this sounds like
  what you're suggesting here). If you can't verify the digest,
  respect the Content-Type and require it to match your expected media
  type (if any).

But in the absence of an HTTP-API spec I don't think we need to talk
about this at all.

[1]: opencontainers#390
[2]: opencontainers#390 (comment)

Signed-off-by: W. Trevor King <wking@tremily.us>
@wking
Copy link
Contributor

wking commented Oct 17, 2016

On Mon, Oct 17, 2016 at 03:42:10PM -0700, Adrian Colley wrote:

Other than the sentence that mentions HTTP headers (quoted above),
the spec does not attempt to resolve conflicts between media types,
and this is fine.

I've filed #392 to drop the line.

wking added a commit to wking/image-spec that referenced this issue Oct 18, 2016
As Adrian Colley points out [1], clients may not be aquiring the
manifest over HTTP.  In most cases, folks will know (from a
Content-Type header, a descriptor media type, or other means) what
type of blob they're dealing with before they look at the blob.  I
expect client behavior like [2]:

  If you can verify the digest, ignore Content-Type.  If you can't
  verify the digest, respect the Content-Type and require it to match
  your expected media type (if any).

But in the absence of an HTTP-API spec I don't think we need to talk
about this at all.

[1]: opencontainers#390
[2]: opencontainers#390 (comment)

Signed-off-by: W. Trevor King <wking@tremily.us>
dattgoswami9lk5g added a commit to dattgoswami9lk5g/bremlinr that referenced this issue Jun 6, 2022
As Adrian Colley points out [1], clients may not be aquiring the
manifest over HTTP.  In most cases, folks will know (from a
Content-Type header, a descriptor media type, or other means) what
type of blob they're dealing with before they look at the blob.  I
expect client behavior like [2]:

  If you can verify the digest, ignore Content-Type.  If you can't
  verify the digest, respect the Content-Type and require it to match
  your expected media type (if any).

But in the absence of an HTTP-API spec I don't think we need to talk
about this at all.

[1]: opencontainers/image-spec#390
[2]: opencontainers/image-spec#390 (comment)

Signed-off-by: W. Trevor King <wking@tremily.us>
7c00d pushed a commit to 7c00d/J1nHyeockKim that referenced this issue Jun 6, 2022
As Adrian Colley points out [1], clients may not be aquiring the
manifest over HTTP.  In most cases, folks will know (from a
Content-Type header, a descriptor media type, or other means) what
type of blob they're dealing with before they look at the blob.  I
expect client behavior like [2]:

  If you can verify the digest, ignore Content-Type.  If you can't
  verify the digest, respect the Content-Type and require it to match
  your expected media type (if any).

But in the absence of an HTTP-API spec I don't think we need to talk
about this at all.

[1]: opencontainers/image-spec#390
[2]: opencontainers/image-spec#390 (comment)

Signed-off-by: W. Trevor King <wking@tremily.us>
7c00d added a commit to 7c00d/J1nHyeockKim that referenced this issue Jun 6, 2022
As Adrian Colley points out [1], clients may not be aquiring the
manifest over HTTP.  In most cases, folks will know (from a
Content-Type header, a descriptor media type, or other means) what
type of blob they're dealing with before they look at the blob.  I
expect client behavior like [2]:

  If you can verify the digest, ignore Content-Type.  If you can't
  verify the digest, respect the Content-Type and require it to match
  your expected media type (if any).

But in the absence of an HTTP-API spec I don't think we need to talk
about this at all.

[1]: opencontainers/image-spec#390
[2]: opencontainers/image-spec#390 (comment)

Signed-off-by: W. Trevor King <wking@tremily.us>
laventuraw added a commit to laventuraw/Kihara-tony0 that referenced this issue Jun 6, 2022
As Adrian Colley points out [1], clients may not be aquiring the
manifest over HTTP.  In most cases, folks will know (from a
Content-Type header, a descriptor media type, or other means) what
type of blob they're dealing with before they look at the blob.  I
expect client behavior like [2]:

  If you can verify the digest, ignore Content-Type.  If you can't
  verify the digest, respect the Content-Type and require it to match
  your expected media type (if any).

But in the absence of an HTTP-API spec I don't think we need to talk
about this at all.

[1]: opencontainers/image-spec#390
[2]: opencontainers/image-spec#390 (comment)

Signed-off-by: W. Trevor King <wking@tremily.us>
tomalopbsr0tt added a commit to tomalopbsr0tt/fabiojosej that referenced this issue Oct 6, 2022
As Adrian Colley points out [1], clients may not be aquiring the
manifest over HTTP.  In most cases, folks will know (from a
Content-Type header, a descriptor media type, or other means) what
type of blob they're dealing with before they look at the blob.  I
expect client behavior like [2]:

  If you can verify the digest, ignore Content-Type.  If you can't
  verify the digest, respect the Content-Type and require it to match
  your expected media type (if any).

But in the absence of an HTTP-API spec I don't think we need to talk
about this at all.

[1]: opencontainers/image-spec#390
[2]: opencontainers/image-spec#390 (comment)

Signed-off-by: W. Trevor King <wking@tremily.us>
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

No branches or pull requests

2 participants