|
| 1 | +# Cosign Attestation Specifications |
| 2 | + |
| 3 | +This document aims to describe how `cosign` attaches `Attestations` to container images. |
| 4 | + |
| 5 | +The goal is to specify the behavior well enough to promote other implementations and enable interoperability. |
| 6 | +Attestations attached with `cosign` should be retrievable in other tools, and vice-versa. |
| 7 | + |
| 8 | +This document focuses on the layout of attestations within an [OCI Image Manifest V1](https://github.com/opencontainers/image-spec/blob/master/manifest.md) object. |
| 9 | + |
| 10 | +This document assumes you are using the In-Toto [Attestation](https://github.com/in-toto/attestation) format, serialized as a `DSSE` envelope |
| 11 | +Other formats can be used, and the `mediaType` property should describe the format of a particular attestation, but implementations may not understand them. |
| 12 | +The DSSE envelope format is defined [here](https://github.com/secure-systems-lab/dsse/blob/master/envelope.md#dsse-envelope) and uses the `mediaType`: `application/vnd.dsse.envelope.v1+json`. |
| 13 | + |
| 14 | +Multiple Attestations may be "attached" to one image. |
| 15 | +Each Attestation may refer to the entire image, or to a specific part of that image. |
| 16 | +This is indicated via the `subject` field of the `Statement` inside the `Attestation`. |
| 17 | + |
| 18 | +Attestations attached to a container image are generally assumed to refer to that image in some way. |
| 19 | + |
| 20 | +## Overall Layout |
| 21 | + |
| 22 | +An `Attestation` object is represented as an [OCI Image Manifest V1](https://github.com/opencontainers/image-spec/blob/master/manifest.md). |
| 23 | + |
| 24 | +Each individual `Attestation` is represented as a `layer`, using a standard `descriptor`. |
| 25 | +The `layers` list is ordered, but no order is assumed or important for the `Attestations`. |
| 26 | + |
| 27 | +Here is an example manifest containing one `Attestation`: |
| 28 | + |
| 29 | +```json |
| 30 | +{ |
| 31 | + "schemaVersion": 2, |
| 32 | + "config": { |
| 33 | + "mediaType": "application/vnd.oci.image.config.v1+json", |
| 34 | + "size": 233, |
| 35 | + "digest": "sha256:83bd5fb5b39f65f28e50a86d48fa79c07880befc292d92eebdc18531054b070c" |
| 36 | + }, |
| 37 | + "layers": [ |
| 38 | + { |
| 39 | + "mediaType": "application/vnd.dsse.envelope.v1+json", |
| 40 | + "size": 246, |
| 41 | + "digest": "sha256:ed3ad03d3b87843b5419d7dce9d50a3e0f45554b2ba93bf378611cae6b450cff", |
| 42 | + } |
| 43 | + ] |
| 44 | +} |
| 45 | +``` |
| 46 | + |
| 47 | +## Subject Verification |
| 48 | + |
| 49 | +`Attestations` MAY refer to multiple `subjects`. |
| 50 | + |
| 51 | +When verifying an attestation for a container image, implementations MUST verify the relationship between the `subject` field and the container image. |
| 52 | +Attestations MAY reference the entire container image or a portion of it. |
| 53 | + |
| 54 | +Implementations MUST support `Attestations` that reference the entire container image, other relationship types are optional. |
0 commit comments