-
Notifications
You must be signed in to change notification settings - Fork 598
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
Add some additional property fileds to cycloneDX output. #685
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pbalogh-sa stellar PR --thanks for opening! The use of properties here helps a TON in the sense of unlocking the use of using CycloneDX formatted documents as input in grype (e.g. the source/origin properties you added).
I think the only thing that looks out of place is the distro
information which has been attached to the BomDescriptor
section. This section is meant to describe the tool and context that created the SBOM. The distro
itself is from the result of cataloging and not truly meant for this BOM Descriptor section.
I'm not certain that there is a good spot for this information in a top-level section in CycloneDX (if there is, shout out! I could have easily missed something here). But, it may be that the easiest path forward is to encode the distro information directly on packages which this information matters for. For instance, capturing distro name and version for rpm
, deb
and apk
as properties on the package (but not capture this information for non-distro packages, such as python, java, etc).
Let me know what you think about this approach @pbalogh-sa --happy to chat it through more.
Signed-off-by: Peter Balogh <[email protected]>
Signed-off-by: Peter Balogh <[email protected]>
Signed-off-by: Peter Balogh <[email protected]>
87abd13
to
6b7f8ba
Compare
@wagoodman I wanted to convert cyclonedx format to syft json, and as I see in the syft json the distro information is in top-level, and not in package level. So This was the reason why I put it into the bomDescriptor section. The distro is only crucial in the case when an image was the input. Putting the distro information at the package level makes sense. For example, if we analyze a source directory and after it, we analyze the docker image we built using that source code we will be able to merge two BOM into one because all information will be in the package level. |
Using the BOM Descriptor is very convenient, but technically not the reason for the section, which is why I can't recommend heading further down that path (maybe keep it in our back pocket as a workaround incase other solutions don't work as well as we hope?). I think the only two downsides (so far) to adding distro information to each package is:
That's true! There is a benefit there I didn't think of. When we get to format conversion, I think this will complicate the case where we are trying to get information transformed back into the syft-native model, but I think we can solve that one later (so shouldn't be a restriction here). @pbalogh-sa are you OK with the per-package approach? or want to keep looking for alternate solutions? (there could be another option in the spec for us) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pbalogh-sa! Thanks for the excellent PR. @wagoodmans comments get to the core of the specification questions I might have here.
I added some small comments regarding the tests to just be sure the correct values are being redacted.
Thanks again!
internal/formats/cyclonedx13json/test-fixtures/snapshot/TestCycloneDxImagePresenter.golden
Show resolved
Hide resolved
internal/formats/cyclonedx13xml/test-fixtures/snapshot/TestCycloneDxImagePresenter.golden
Show resolved
Hide resolved
@wagoodman Currently distro is in the level of |
@pbalogh-sa We recently got in a feature that may help here: #754 Now we're encoding distro information onto each package within the pURL. In the near future the pURL will be used downstream in grype for vulnerability matching (enabling OS-level matching as we do today). Does this change fit your needs? |
@wagoodman Thanks, along with #710 can fit my needs. I will check it. |
@wagoodman In the case of Java artifactID and groupID are missing. I found the reason: syft/internal/formats/common/cyclonedxhelpers/properties.go Lines 28 to 44 in 1350d6c
Maybe we need to check lower level structs for properties. |
@pbalogh-sa With #758 merged, I think the remaining items on this PR are:
Let me know if there is anything I can do to help (or if I got the above list wrong)! |
Signed-off-by: Peter Balogh [email protected]
Related anchore/grype#481
This PR adds some additional properties to the CycloneDX output. After converting the generated CyclonDX format to Syft JSON format with these properties, the Grype using the converted json can find the vulnerabilities.