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

Attaching the SBOM and provenance artifact to the Image artifact #1260

Open
wieringen opened this issue Nov 15, 2024 · 5 comments
Open

Attaching the SBOM and provenance artifact to the Image artifact #1260

wieringen opened this issue Nov 15, 2024 · 5 comments

Comments

@wieringen
Copy link

wieringen commented Nov 15, 2024

When I use oras to attach an artifact to an image artifact, it's displayed in a parent/child relation in the UI of Google Cloud Artifact registry.
Image

oras attach --artifact-type doc/example repo/image:digest sbom.json

When I use build-push-action this is not the case. The provenance and sbom artifacts are displayed like normal artifacts and no relationship is visible at first glance.
Image

After comparing some of the manifests, I noticed that oras adds a field called subject to the manifest of the sbom and provenance artifacts with a reference to the digest of the image.
"subject": { "mediaType": "application/vnd.oci.image.index.v1+json", "digest": "sha256:the_digest_of_the_image", "size": 856 },
Can this be done by build-push-action as well?

@crazy-max
Copy link
Member

Can we pull these images to take a look?

Fyi attestations are attached to the root image index, see https://docs.docker.com/build/metadata/attestations/attestation-storage/#attestation-manifest-descriptor

@dvdksn
Copy link
Contributor

dvdksn commented Nov 15, 2024

🤔 Looks like subject was added (to index and manifest) in image spec 1.1.0

@wieringen
Copy link
Author

wieringen commented Nov 15, 2024

Can we pull these images to take a look?

Fyi attestations are attached to the root image index, see https://docs.docker.com/build/metadata/attestations/attestation-storage/#attestation-manifest-descriptor

I'm sorry the images are private. Luckily, it's very easy to replicate.
oras attach --artifact-type doc/example --annotation "key1=val1" --annotation "key2=val2" localhost:5000/hello:v1

Point this at any existing image you have, and it will create an attached artifact at that location.

I know I can look at the manifest to see what kind of artifact it is, but this is a bit of a hassle. There is too much noise at the moment.

@crazy-max
Copy link
Member

crazy-max commented Nov 19, 2024

, it's very easy to replicate.
oras attach --artifact-type doc/example --annotation "key1=val1" --annotation "key2=val2" localhost:5000/hello:v1

Not sure I understand, with buildkit attestations are already attached to the image index like this one: https://explore.ggcr.dev/?image=moby%2Fbuildkit%3Alatest (see this manifest https://explore.ggcr.dev/?image=moby/buildkit@sha256:e9bbe9e3b33be6d4a396fd92bdd03e050d1a8325e0205e87d7aec3c9b81bc243&mt=application%2Fvnd.oci.image.manifest.v1%2Bjson&size=1113)

@dvdksn
Copy link
Contributor

dvdksn commented Nov 19, 2024

@crazy-max IIUC, the attestation manifest can have a subject descriptor that points to the image's index.

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

3 participants