-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
Incorrect/Extra Data included in sbom. #20
Comments
Hi @dlorenc, thank you for the detailed report. What you're seeing is the result of cyclonedx-gomod (or Go's own module tooling rather) not knowing which modules end up in the final product. We use Regarding
Searching Based on that,
I think we could use something along the lines of Edit: In essence, what cyclonedx-gomod is currently missing is analysis of package imports. This is what I get for the "go list" command above. Looks somewhat more reasonable.
|
Note to self: Use
Should also remove the necessity of running |
I agree - this is unintuitive at first but a go module is not 1:1 with a compiled go "application". You can have many applications under one module, and the module deps are the set of all the applications. |
Following up on a discussion in the CDX Slack, we should support the generation of BOMs that either do or don't consider build constraints. Which variant is chosen will depend on what the BOMs are supposed to be used for:
Variant 1 also isn't really feasable for libraries. Maintainers simply cannot know the set of build constraints their users work with. Distributing a BOM as generated by variant 2 for libraries makes sense however. Overall, this means that Supporting variant 2 will cover most use cases and will be prioritized. |
It also doesn't consider build flags, which is exactly what we want. A few examples with
For test-only dependencies, the package list contains a
The only downside is that we can't differentiate between multiple commands, like we can with I'm thinking of implementing a short-term solution, where we query |
#20 (comment) has been shipped with v0.8.0 (via #25). I'm leaving this issue open until we also implemented a solution for variant 1 from #20 (comment). |
Following up on #20 (comment): I implemented a PoC that utilizes An example with The SBOMs have been generated with the following commands:
Where As expected, the SBOM generated with |
There seems to be different interpretations of what an SBoM should or shouldn't include. From my limited experience working with several large and small customers below are some of the things I learnt.
|
Agreed, although in many cases today, the tools that consume these SBOMs do not differentiate between |
This comment has been minimized.
This comment has been minimized.
Removed the bug label, as "incorrect / extra data" isn't really true for the use-case that cyclonedx-gomod covers right now, which is module-level SBOMs. The enhancement of supporting application-level SBOMs has been moved to #44. |
This has been addressed with the new |
Thanks! |
Signed-off-by: nscuro <[email protected]>
* add instructions for goreleaser integration Signed-off-by: nscuro <[email protected]> * don't be too verbose on hashes explanation Signed-off-by: nscuro <[email protected]> * fix and improve code documentation; update changelog Signed-off-by: nscuro <[email protected]> * cli documentation tweaks Signed-off-by: nscuro <[email protected]> * reference #20 in changelog Signed-off-by: nscuro <[email protected]> * readme tweaks Signed-off-by: nscuro <[email protected]> * update examples docker image to include sbom validation Signed-off-by: nscuro <[email protected]> * correction Signed-off-by: nscuro <[email protected]> * update changelog Signed-off-by: nscuro <[email protected]> * improve cli documentation Signed-off-by: nscuro <[email protected]> * update cli help in readme Signed-off-by: nscuro <[email protected]> * update changelog Signed-off-by: nscuro <[email protected]> * update cli docs and readme Signed-off-by: nscuro <[email protected]> * regenerate example sboms Signed-off-by: nscuro <[email protected]> * fix InvalidSerialNumber test Signed-off-by: nscuro <[email protected]> Closes #31
I tried out this tool on an open source repo I maintain called
cosign
. The repo is here: https://github.com/sigstore/cosignI ran the tool at cosign commit
749c7e3e5d80f3fa976f31084317a556718c3e54
.The cyclonedx-gomod version I used was
35b214b43eabfdf6b47499427b93c23ae1f903aa
.I ran:
$ cyclonedx-gomod -json > gomod.json
The resulting sbom is available here: https://gist.github.com/dlorenc/17c0582acb0560807e561e436cf76a1e
The tool worked, but a quick look at the data shows some packages that are not included in my application. For example:
bazil.org/fuse does not appear in my application at all, including it's dependency tree. I do not vendor my code normally (I saw the warnings about this tool only partially supporting vendoring). But if I run
go mod vendor
, I do not see bazil.org/fuze anywhere in the vendor tree. I can build and run my code without that package, so I think it's a bug that it appears in the SBOM.You can see a test branch with the vendor directory here: https://github.com/dlorenc/cosign/tree/vendor/vendor/github.com
Note that this is just the first component in the list and the first that I checked. There may be other things missing or incorrect.
Am I misunderstanding the fields? Is there some reason this is included?
Note: This does appear in my go.sum file, but not in the vendor directory and it never makes it into my compiled application, as can be shown by the vendor directory. This means it is used somehow in the dependency constraint calculation by "go mod".
Note that there are
The text was updated successfully, but these errors were encountered: