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

Attach SBOMs to built images. #149

Merged
merged 3 commits into from
Mar 28, 2022
Merged

Conversation

mattmoor
Copy link
Member

This change attaches SBOMs to the oci.SignedImages we build up, and these are published thanks to the previous commit in this series.

I have added validation that for each of the examples we have that we scan download its SBOM with cosign.

Fixes: #145

Based on #147

pkg/build/oci/oci.go Outdated Show resolved Hide resolved
if len(sbomFormats) > 0 {
var mt ggcrtypes.MediaType
var path string
switch sbomFormats[0] {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently cosign's method for associating SBOMs supports a single type of SBOM, so I simply pick the first when multiple are emitted. This can be controlled by restricting or reordering the sbom formats.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an issue we can reference here (and in ko-build/ko#661) so we can switch to publishing both/all when the API supports it?

switch sbomFormats[0] {
case "spdx":
mt = ctypes.SPDXMediaType
path = filepath.Join(sbomPath, fmt.Sprintf("sbom-%s.spdx.json", arch.ToAPK()))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish the SBOM metadata were surfaced in a way we could plumb through to here, but the file list is effectively discarded today. We should consider ways to improve the way this is plumbed through.

@mattmoor mattmoor force-pushed the attach-sboms branch 2 times, most recently from 87b15ba to 2feee5f Compare March 28, 2022 13:50
This change attaches SBOMs to the `oci.SignedImage`s we build up, and these are published thanks to the previous commit in this series.

I have added validation that for each of the examples we have that we scan download its SBOM with cosign.

Fixes: chainguard-dev#145
@mattmoor mattmoor changed the title [WIP] Attach SBOMs to built images. Attach SBOMs to built images. Mar 28, 2022
@mattmoor mattmoor requested a review from puerco March 28, 2022 16:35
pkg/build/oci/oci.go Outdated Show resolved Hide resolved
.github/workflows/mink-e2e.yaml Outdated Show resolved Hide resolved
@kaniini
Copy link
Contributor

kaniini commented Mar 28, 2022

Looks fine to me, given that we can't just fix cosign immediately.

@kaniini kaniini merged commit 4b6dcc1 into chainguard-dev:main Mar 28, 2022
@mattmoor mattmoor deleted the attach-sboms branch March 28, 2022 19:04
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

Successfully merging this pull request may close these issues.

Publish SBOMs
4 participants