feat: support cosign signatures in OCI-SIF files #108
Merged
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.
Add support for cosign signatures / attestations associated with images and indexes within OCI-SIF files.
Storage within the OCI-SIF
A cosign signature or attestation is an OCI image. It is associated with the image or index it targets using a tag based approach. The signature or attestation has a tag indicating the digest of its target.
Within an OCI-SIF file, we will store cosign signatures and annotations so that they have a
org.opencontainers.image.ref.name
annotation in the root index, where theref.name
is a placeholder_cosign
repository followed by the standard cosign tag, e.g.:
SourceSink
The cosign module defines
SignedImage
andSignedImageIndex
types, which wrap the standard ggcr image / index types. Because signatures / attestations are seperate images, associated with their target by tag, aSignedImage
orSignedImageIndex
needs to be able to access blobs outside of the scope of the wrapped image or index, to 'see' thesignatures / attestations.
This PR introduces a SIF
SourceSink
, which is both aSource
and aSink
. A Source implementsGet()
to return aDescriptor
that can provide an Image or an Index, depending on the content of the layout and the options that Get() was called with.A
Descriptor
can be upgraded to aSignedDescriptor
, which provides access to raw cosign signature/attestation images, as well ascosign.SignedImage/SignedImageIndex
types.A Sink implements
Write()
, accepting a Writable which is either a v1.Image or v1.Index. Options allow the image or index to have aname.ref
annotation set in the root index when it is written.Note that at this point, cosign signature / attestation images must be explicilty written into the SIF.
Write
does not automatically write associated signatures / attestations if passed aSignedImage
.