-
Notifications
You must be signed in to change notification settings - Fork 779
Working Group Proposal for Reference Types #934
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,74 @@ | ||||||
| # OCI Artifact Manifest Specification | ||||||
|
|
||||||
| The goal of the Artifact Manifest Specification is to define content addressable artifacts in order to store them along side container images in a registry. | ||||||
| Like [OCI Images](manifest.md), OCI Artifacts may be referenced by the hash of their manifest. | ||||||
| Unlike OCI Images, OCI Artifacts are not meant to be used by any container runtime. | ||||||
|
|
||||||
| Examples of artifacts that may be stored along with container images are Software Bill of Materials (SBOM), Digital Signatures, Provenance data, Supply Chain Attestations, scan results, and Helm charts. | ||||||
|
|
||||||
| This section defines the `application/vnd.oci.artifact.manifest.v1+json` [media type](media-types.md). | ||||||
| For the media type(s) that this is compatible with see the [matrix](media-types.md#compatibility-matrix). | ||||||
|
|
||||||
| # Artifact Manifest | ||||||
|
|
||||||
| ## *Artifact Manifest* Property Descriptions | ||||||
|
|
||||||
| - **`mediaType`** *string* | ||||||
|
|
||||||
| This property MUST be used and contain the media type `application/vnd.oci.artifact.manifest.v1+json`. | ||||||
|
|
||||||
| - **`artifactType`** *string* | ||||||
|
|
||||||
| This property SHOULD be used and contain the mediaType of the referenced artifact. | ||||||
| If defined, the value MUST comply with [RFC 6838][rfc6838], including the [naming requirements in its section 4.2][rfc6838-s4.2], and MAY be registered with [IANA][iana]. | ||||||
|
|
||||||
| - **`blobs`** *array of objects* | ||||||
|
|
||||||
| This OPTIONAL property is an array of objects and each item in the array MUST be a [descriptor](descriptor.md). | ||||||
| Each descriptor represents an artifact of any IANA mediaType. | ||||||
sudo-bmitch marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| The list MAY be ordered for certain artifact types like scan results. | ||||||
|
|
||||||
| - **`refers`** *[descriptor](descriptor.md)* | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for clarity, this is the field that "refers to" the originating object?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. The phrasing there can use work. I think it has bounced around several editors until getting punted to "read the distribution-spec". |
||||||
|
|
||||||
| This OPTIONAL property specifies a [descriptor](descriptor.md) of another manifest. | ||||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cc @vbatts @sudo-bmitch - Does this provide more clarity in response to https://github.com/opencontainers/image-spec/pull/934/files/5240cdaf5cfb2f62f1b6b8860e5561332437270e#r955050333
Suggested change
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think so. (please put that sentence on its own newline) |
||||||
| This value, used by the [`referrers` API](https://github.com/opencontainers/distribution-spec/blob/main/spec.md#listing-referrers), indicates a relationship to the specified manifest. | ||||||
|
|
||||||
| - **`annotations`** *string-string map* | ||||||
|
|
||||||
| This OPTIONAL property contains additional metadata for the artifact manifest. | ||||||
| This OPTIONAL property MUST use the [annotation rules](annotations.md#rules). | ||||||
|
|
||||||
| See [Pre-Defined Annotation Keys](annotations.md#pre-defined-annotation-keys). | ||||||
|
|
||||||
| Annotations MAY be used to filter the response from the [`referrers` API](https://github.com/opencontainers/distribution-spec/blob/main/spec.md#listing-referrers). | ||||||
|
|
||||||
| ## Examples | ||||||
|
|
||||||
| *Example showing an artifact manifest for an example SBOM referencing an image:* | ||||||
|
|
||||||
| ```jsonc,title=Manifest&mediatype=application/vnd.oci.artifact.manifest.v1%2Bjson | ||||||
| { | ||||||
| "mediaType": "application/vnd.oci.artifact.manifest.v1+json", | ||||||
| "artifactType": "application/vnd.example.sbom.v1" | ||||||
| "blobs": [ | ||||||
| { | ||||||
| "mediaType": "application/gzip", | ||||||
| "size": 123, | ||||||
| "digest": "sha256:87923725d74f4bfb94c9e86d64170f7521aad8221a5de834851470ca142da630" | ||||||
| } | ||||||
| ], | ||||||
| "refers": { | ||||||
| "mediaType": "application/vnd.oci.image.manifest.v1+json", | ||||||
| "size": 1234, | ||||||
| "digest": "sha256:cc06a2839488b8bd2a2b99dcdc03d5cfd818eed72ad08ef3cc197aac64c0d0a0" | ||||||
| }, | ||||||
| "annotations": { | ||||||
| "org.opencontainers.artifact.created": "2022-01-01T14:42:55Z", | ||||||
| "org.example.sbom.format": "json" | ||||||
| } | ||||||
| } | ||||||
| ``` | ||||||
|
|
||||||
| [iana]: https://www.iana.org/assignments/media-types/media-types.xhtml | ||||||
| [rfc6838]: https://tools.ietf.org/html/rfc6838 | ||||||
| [rfc6838-s4.2]: https://tools.ietf.org/html/rfc6838#section-4.2 | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,12 @@ | ||
| # OCI Content Descriptors | ||
|
|
||
| * An OCI image consists of several different components, arranged in a [Merkle Directed Acyclic Graph (DAG)](https://en.wikipedia.org/wiki/Merkle_tree). | ||
| * References between components in the graph are expressed through _Content Descriptors_. | ||
| * A Content Descriptor (or simply _Descriptor_) describes the disposition of the targeted content. | ||
| * A Content Descriptor includes the type of the content, a content identifier (_digest_), and the byte-size of the raw content. | ||
| * Descriptors SHOULD be embedded in other formats to securely reference external content. | ||
| * Other formats SHOULD use descriptors to securely reference external content. | ||
| - An OCI image consists of several different components, arranged in a [Merkle Directed Acyclic Graph (DAG)](https://en.wikipedia.org/wiki/Merkle_tree). | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this a space to clarify that descriptors are not exclusive to "An OCI image"?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That would make a good follow up PR. This line is showing up in the change log because I switched the list bullets from
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah fair |
||
| - References between components in the graph are expressed through _Content Descriptors_. | ||
| - A Content Descriptor (or simply _Descriptor_) describes the disposition of the targeted content. | ||
| - A Content Descriptor includes the type of the content, a content identifier (_digest_), and the byte-size of the raw content. | ||
| Optionally, it includes the type of artifact it is describing. | ||
| - Descriptors SHOULD be embedded in other formats to securely reference external content. | ||
| - Other formats SHOULD use descriptors to securely reference external content. | ||
|
|
||
| This section defines the `application/vnd.oci.descriptor.v1+json` [media type](media-types.md). | ||
|
|
||
|
|
@@ -51,8 +52,16 @@ The following fields contain the primary properties that constitute a Descriptor | |
| The decoded data MUST be identical to the referenced content and SHOULD be verified against the [`digest`](#digests) and `size` fields by content consumers. | ||
| See [Embedded Content](#embedded-content) for when this is appropriate. | ||
|
|
||
| - **`artifactType`** *string* | ||
lachie83 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| This OPTIONAL property contains the type of an artifact when the descriptor points to an artifact. | ||
| This is the value of `artifactType` when the descriptor references an [artifact manifest](artifact.md). | ||
| This is the value of the config descriptor `mediaType` when the descriptor references an [image manifest](manifest.md). | ||
|
|
||
| Descriptors pointing to [`application/vnd.oci.image.manifest.v1+json`](manifest.md) SHOULD include the extended field `platform`, see [Image Index Property Descriptions](image-index.md#image-index-property-descriptions) for details. | ||
|
|
||
| Descriptors pointing to [`application/vnd.oci.artifact.manifest.v1+json`](artifact.md) SHOULD include the extended field `artifactType`. | ||
|
|
||
| ### Reserved | ||
|
|
||
| Extended _Descriptor_ field additions proposed in other OCI specifications SHOULD first be considered for addition into this specification. | ||
|
|
@@ -68,7 +77,7 @@ The _algorithm_ specifies the cryptographic hash function and encoding used for | |
|
|
||
| A digest string MUST match the following [grammar](considerations.md#ebnf): | ||
|
|
||
| ``` | ||
| ```ebnf | ||
| digest ::= algorithm ":" encoded | ||
| algorithm ::= algorithm-component (algorithm-separator algorithm-component)* | ||
| algorithm-component ::= [a-z0-9]+ | ||
|
|
@@ -104,12 +113,14 @@ Implementations MAY employ [canonicalization](considerations.md#canonicalization | |
| ### Digest calculations | ||
|
|
||
| A _digest_ is calculated by the following pseudo-code, where `H` is the selected hash algorithm, identified by string `<alg>`: | ||
| ``` | ||
|
|
||
| ```text | ||
| let ID(C) = Descriptor.digest | ||
| let C = <bytes> | ||
| let D = '<alg>:' + Encode(H(C)) | ||
| let verified = ID(C) == D | ||
| ``` | ||
|
|
||
| Above, we define the content identifier as `ID(C)`, extracted from the `Descriptor.digest` field. | ||
| Content `C` is a string of bytes. | ||
| Function `H` returns the hash of `C` in bytes and is passed to function `Encode` and prefixed with the algorithm to obtain the digest. | ||
|
|
@@ -190,6 +201,17 @@ In the following example, the descriptor indicates that the referenced manifest | |
| } | ||
| ``` | ||
|
|
||
| In the following example, the descriptor indicates the type of artifact it is referencing: | ||
|
|
||
| ```json,title=Content%20Descriptor&mediatype=application/vnd.oci.descriptor.v1%2Bjson | ||
| { | ||
| "mediaType": "application/vnd.oci.artifact.manifest.v1+json", | ||
| "size": 123, | ||
| "digest": "sha256:87923725d74f4bfb94c9e86d64170f7521aad8221a5de834851470ca142da630", | ||
| "artifactType": "application/vnd.example.sbom.v1" | ||
| } | ||
| ``` | ||
|
|
||
| [rfc3986]: https://tools.ietf.org/html/rfc3986 | ||
| [rfc4634-s4.1]: https://tools.ietf.org/html/rfc4634#section-4.1 | ||
| [rfc4634-s4.2]: https://tools.ietf.org/html/rfc4634#section-4.2 | ||
|
|
@@ -198,3 +220,4 @@ In the following example, the descriptor indicates that the referenced manifest | |
| [rfc6838-s4.2]: https://tools.ietf.org/html/rfc6838#section-4.2 | ||
| [rfc7230-s2.7]: https://tools.ietf.org/html/rfc7230#section-2.7 | ||
| [sha256-vs-sha512]: https://groups.google.com/a/opencontainers.org/forum/#!topic/dev/hsMw7cAwrZE | ||
| [iana]: https://www.iana.org/assignments/media-types/media-types.xhtml | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| // Copyright 2022 The Linux Foundation | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| package v1 | ||
|
|
||
| // Artifact describes an artifact manifest. | ||
| // This structure provides `application/vnd.oci.artifact.manifest.v1+json` mediatype when marshalled to JSON. | ||
| type Artifact struct { | ||
| // MediaType is the media type of the object this schema refers to. | ||
| MediaType string `json:"mediaType"` | ||
|
|
||
| // ArtifactType is the IANA media type of the artifact this schema refers to. | ||
| ArtifactType string `json:"artifactType"` | ||
|
|
||
| // Blobs is a collection of blobs referenced by this manifest. | ||
| Blobs []Descriptor `json:"blobs,omitempty"` | ||
|
|
||
| // Refers is an optional link to any existing manifest within the repository. | ||
| Refers *Descriptor `json:"refers,omitempty"` | ||
|
|
||
| // Annotations contains arbitrary metadata for the artifact manifest. | ||
| Annotations map[string]string `json:"annotations,omitempty"` | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| // Copyright 2016 The Linux Foundation | ||
| // Copyright 2016-2022 The Linux Foundation | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
|
|
@@ -44,6 +44,9 @@ type Descriptor struct { | |
| // | ||
| // This should only be used when referring to a manifest. | ||
| Platform *Platform `json:"platform,omitempty"` | ||
|
|
||
| // ArtifactType is the IANA media type of this artifact. | ||
| ArtifactType string `json:"artifactType,omitempty"` | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is used in the Referrers listing.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. needs some explanation regarding the parts of the spec that are descriptors and what the artifact type field currently means in those contexts.. will try to draft something probably needs more examples |
||
| } | ||
|
|
||
| // Platform describes the platform which the image in the manifest runs on. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.