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

Support SBOM creation for container image indexes #1683

Open
eliaslevy opened this issue Mar 20, 2023 · 7 comments
Open

Support SBOM creation for container image indexes #1683

eliaslevy opened this issue Mar 20, 2023 · 7 comments
Labels
enhancement New feature or request needs-discussion

Comments

@eliaslevy
Copy link

What would you like to be added:
Create an SBOM when given a container reference that points to a container image index that includes the dependencies of all the image manifests the index points to.

Why is this needed:
Multi-architecture and multi-platform container images are becoming more common.

Additional context:
Syft supports creating an SBOM from a container reference. When given a reference, Syft will pull the reference to download the container image. When the reference points to a container image index, Syft will download one of the underlaying images depending on that platform the tool is run on, and generate an SBOM from that image. That means that the dependencies of the alternate images are not cataloged and documented in the SBOM, creating a visibility gap.

Syft should optionally download each underlaying image and document the dependencies in all of them. Ideally Syft would model the image index and image manifests as packages in the SBOM with appropriate relationships, so that the dependency graph information is recorded.

@eliaslevy eliaslevy added the enhancement New feature or request label Mar 20, 2023
@kzantow kzantow added this to OSS Mar 22, 2023
@kzantow kzantow moved this to Awaiting Response in OSS Apr 27, 2023
@kzantow
Copy link
Contributor

kzantow commented Apr 27, 2023

Syft can download different architectures when using the --platform flag, but is unable to combine multiple sources into a single SBOM today. Would you be able to just use this flag to create separate SBOMs for each image architecture?

We investigated combining multiple SBOMs into a single one, but there are some definite issues with this. Feel free to read this issue for some more information there.

@eliaslevy
Copy link
Author

We could generate SBOMs for each underlying container image separately, then merge them into a single SBOM. But I believe this is a common enough use case that Syft should support it.

Multi-architecture and multi-platform images are exposed to the user via the image index digest. So when they request an SBOM for the artifact, they will use that identifier in the lookup, rather than a digest for one of the underlying image manifests.

@tgerla tgerla removed the status in OSS May 4, 2023
@kzantow
Copy link
Contributor

kzantow commented May 25, 2023

Hi @eliaslevy at present this request requires a couple different things:

  1. we need to be able to scan multiple images for all architectures given an image tag
  2. we need to be able to combine multiple SBOMs into a single SBOM

Today, we don't have either of these features on the roadmap. Combining multiple SBOMs, for example, is a nontrivial task that requires understanding about what packages and files mean within the context of the provided SBOM.

That said, we always accept PRs and we're always happy to talk about this on Slack or our community office hours!

@JonZeolla
Copy link

I would think (at least in my scenario) that making a per-platform SBOM from a multi-platform manifest would be a very valuable step forward

@stevehipwell
Copy link

There are documented semantics for SPDX and this use case. AFAIK apko, ko & bom all already follow this semantic pattern (reference).

@willmurphyscode
Copy link
Contributor

Hi all! We discussed this on our livestream today and we have some ideas:

  1. The best way to unblock this is to add a mutli-image source in stereoscope, essentially adding a dimension to the file coordinates, so that the file coordinate is a tuple of (image, layer, path) instead of just (layer, path). This might be a fair bit of work, but it might unblock allowing Syft to have multiple images in flight at the same time without a major rewrite. I'll open an issue in anchore/stereoscope to track testing whether this is possible.
  2. This is going to be a relatively heavy lift, regardless of how we do it. In the meantime, your best workaround is probably to use crane or similar to get a list of images from the manifest, and invoke Syft on each of them.

@stevehipwell
Copy link

@willmurphyscode providing the specification for the output SBOM would be the first step. FYI I'm not sure if the standards I linked above are actually in use. After there is a standard Syft could add support to merge the SBOMs created using crane to get the layers and Grype could then scan the result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs-discussion
Projects
Status: Backlog
Development

No branches or pull requests

6 participants