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

Supporting buildkit's SBOMs / attestations #2688

Closed
imjasonh opened this issue Feb 2, 2023 · 9 comments
Closed

Supporting buildkit's SBOMs / attestations #2688

imjasonh opened this issue Feb 2, 2023 · 9 comments
Labels
no-issue-activity question Further information is requested

Comments

@imjasonh
Copy link
Member

imjasonh commented Feb 2, 2023

Question

Docker's buildkit and buildx can produce SBOMs and Provenance attestations when it builds an image using a Dockerfile (that's good!). They emit this information in a format that's different from cosign's format, described here: https://github.com/moby/buildkit/tree/master/docs/attestations

TL;DR: attestations are included in an image index manifest alongside the image(s) that are built, with the descriptor having a platform of unknown and annotations describing the image they're referring to, and how. These descriptors point to an OCI image manifest with layers pointing to blobs (SBOM example, more examples).

This means that attestations can't be attached to existing images in this format without modifying the digest of the manifest, and attestations aren't signed as described in those links above. Signing might be coming in a future release, I have no idea.

I don't think cosign or related tooling should produce attestations in this way, but maybe it'd be worth teaching cosign and policy-controller, etc., how to discover these attestations, and make decisions based on them, in addition to understanding cosign's externally-attached signed attestations.

@imjasonh imjasonh added the question Further information is requested label Feb 2, 2023
@dlorenc
Copy link
Member

dlorenc commented Feb 4, 2023

Question

Docker's buildkit and buildx can produce SBOMs and Provenance attestations when it builds an image using a Dockerfile (that's good!). They emit this information in a format that's different from cosign's format, described here: https://github.com/moby/buildkit/tree/master/docs/attestations

TL;DR: attestations are included in an image index manifest alongside the image(s) that are built, with the descriptor having a platform of unknown and annotations describing the image they're referring to, and how. These descriptors point to an OCI image manifest with layers pointing to blobs (SBOM example, more examples).

This means that attestations can't be attached to existing images in this format without modifying the digest of the manifest, and attestations aren't signed as described in those links above. Signing might be coming in a future release, I have no idea.

I don't think cosign or related tooling should produce attestations in this way, but maybe it'd be worth teaching cosign and policy-controller, etc., how to discover these attestations, and make decisions based on them, in addition to understanding cosign's externally-attached signed attestations.

Note that they're not signed, so we'll have to be careful about the UX on these. I agree we should support metadata in policy-controller or something, but we'll have to be clear on the difference between signed and unsigned data.

@amdawson
Copy link

amdawson commented Feb 7, 2023

related: sigstore/policy-controller#552

@stefanprodan
Copy link

stefanprodan commented Feb 8, 2023

For Flux we publish SBOMs for our multi-arch images using Docker GitHub Action and we sign the multi-arch images with Cosign. I've tried downloading the SBOM with cosign but this fails like so:

$ cosign download sbom --platform=linux/amd64 ghcr.io/fluxcd/source-controller:v0.34.0

This multiarch image does not have an SBOM attached at the index level.
Try using --platform with one of the following architectures:
linux/amd64, linux/arm/v7, linux/arm64, unknown/unknown, unknown/unknown, unknown/unknown

Error: no SBOM found attached to image index
main.go:62: error during command execution: no SBOM found attached to image index

@dlorenc Is there a plan to make cosign download sbom compatible with Docker SBOM layers?

@imjasonh
Copy link
Member Author

imjasonh commented Feb 8, 2023

@dlorenc Is there a plan to make cosign download sbom compatible with Docker SBOM layers?

I believe this issue is the closest we have to a "plan", at least it's where we're discussing whether and how to support it.

I think Dan's point about the unsigned-by-default nature of Docker SBOMs is a good one, we don't want folks to be too confident in the SBOM if it's unsigned (same with cosign-attached unsigned SBOMs, FWIW). But if the index containing the SBOM is signed, then IMO we should trust it the same as a signed SBOM attestation produced by cosign.

@github-actions
Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions
Copy link

This issue was closed because it has been stalled for 5 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 15, 2023
@nettrino
Copy link

Is there an alternative option for downloading sboms from ghcr or equivalent?

@scott-hpe
Copy link

I was experementing with docker buildkit in GHA and ran into this issue where I could not use cosign to download the unsigned SBOM created by docker buildkit. We are currently experementing with multi-platform build images and looking for the most effecent way in GHA to handle the build to include sbom generation and signing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-issue-activity question Further information is requested
Projects
None yet
Development

No branches or pull requests

7 participants