-
Notifications
You must be signed in to change notification settings - Fork 591
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Support to stack multiple Syft SBOM files into a single one #617
Comments
Would JSON Lines work for this situation? The idea would be to keep the change pretty simple, and support processing concatenated instances of the existing Syft JSON output.
❤️ I like the idea of applying this constraint, especially to the first iteration. Would we have to support differing schema versions among the received JSON objects? Perhaps a constraint similar to the above could be applied here (i.e. require homogeneous JSON objects). Would Syft's existing explicit |
@hectorj2f I 100% agree with the observations on the I think
My take on possible answers here:
|
If we're getting into the business of merging Example: Here is the
Here is the same artifact as seen generated under the
The ID are different in this case because the locations field contains different paths for where the artifact was discovered. In the merged SBOM do we want to try and account for these being basically identical and merging the locations field under a single artifact, or do we want to keep things totally separate? This also adds more weight to the Or... more generally. How could we merge artifacts that have the same ID? |
Also just validated - Removing the meta top-level fields from
Valid Input to
I'll follow here with a PR so the json presenter can parse this as well. It only works for table output. |
Are we asking this from the perspective of Grype? Does Grype have a need to see a given package only a single time? My two cents would be not to introduce any deduplication — particularly in a first iteration — unless we need to. |
Open question: Should this issue move to anchore/grype? I know the implementation might involve Syft's decoders, but it seems like a Grype feature that we're talking about from the user's perspective. Is that a correct read on this? |
Another question I found - Is https://github.com/anchore/syft/blob/main/internal/formats/syftjson/validator.go This would make the JSON API a little simpler since then both We're at |
In my opinion, it won't be bad a cli command to merge or append multiple sboms files into one. |
We (@developer-guy) have been trying to figure it out how we can merge multiple sbom results into single one and finally ended up here. We're generating 2 SBOMs by issuing following commands:
We found the following workaround:
Ref: https://e.printstacktrace.blog/merging-json-files-recursively-in-the-command-line It just works! It would be nice to have a subcommand,
We assumed here both SBOMs are same type. In case one of is different, then we should probably convert it: #563 cc @luhring |
@Dentrax thanks so much for the follow-up here with the CLI version of merging SBOM. I like the suggestion of syft taking in two files and doing the merge itself. Is there another interaction we want to explore here where syft generates the SBOM from the artifacts and merges in the same command?
|
How should we proceed here? There is another way to handle this by accepting multiple args in
Also
|
...pong!
This is something we're interested in doing (see #562). The issue isn't really how to scan multiple targets at a time, and how to specify it on the CLI --this is the easy part. The real problem is how should an SBOM describe multiple If we scan multiple targets then the SBOM will need to additionally convey: Item
Pros:
Cons:
Pros:
Cons:
Open questions:
Previous questions that have been answered by this point:
I think that we need to answer how will the format address these problems / use cases before diving into how the command will look / feel. |
FYI -- we are actively discussing this and for anyone interested it would be a great topic for the next community meeting, which will be Sep. 1 at 12 noon ET: https://calendar.google.com/calendar/u/0/r?cid=Y182OTM4dGt0MjRtajI0NnNzOThiaGtnM29qNEBncm91cC5jYWxlbmRhci5nb29nbGUuY29t |
Kind ping 🤞 |
@Dentrax we are actively working on this, it's a complicated change and will need to get support implemented in Grype, too before we get everything merged 👍 |
An update here: we are currently putting this on hold, as there have been a number of discussions which highlight making this a particularly challenging thing to implement properly. We do plan on revisiting this in the future when some of the roadblocks are lifted. |
Just a small update on this issue - We've marked this as blocked since there is not a clear way forward on the representation of multiple SBOM across all the formats syft supports. There is currently some work being done on representing SBOM connections via relationships that are surfaced when running the SBOM cataloger. There is a clear way forward to represent this internally with the syft SBOM format, but larger questions exist on how to do this via the different standard formats of SPDX and CycloneDX. If the SBOMS all have the same source node there is a straightforward path for all 3 formats given that we can associate all packages to the same source node with the correct relationships. The path forward via the SBOM cataloger currently combines all packages with NO source relationships which we believe is not the desired end state of how the data should be represented or what is being asked for on this thread. I'm dropping this into the backlog of our team's board while we work through the details surrounding the graph representation of what multiple sources for multiple sbom look like. |
What would you like to be added:
CycloneDX supports merging multiple SBOM files into a single one. However Syft SBOM does not support merging multiple Syft SBOM files. One way could be done by manual merging the artifacts however that is limited to SBOM files whose
distro
is the same for all the different files.We would like that Syft SBOM can be merged into a single one without lacking of accuracy to identify vulnerabilities.
Why is this needed:
We generate a bundle and store it in a registry, but the artifacts linked to that bundle are composed of multiple SBOMS from each component that forms that bundle. When using CycloneDX, those SBOM files can be merged into one without losing accuracy to identify vulnerabilities. This can be achieved because the
purl
contains the arch (or distro) injected into the value. We would like to find a solution to satisfy the same scenario with Syft SBOM format.Additional context:
The text was updated successfully, but these errors were encountered: