-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat(report): Implement SBOM SPDX-JSON format reporter #2339
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
Conversation
|
@ReiPenguin |
The spec for SPDX v3.0 is out, but we're only supporting up to v2.3 for the time being for a couple of reasons:
|
e06d92e to
36ada28
Compare
reporter/sbom/spdx.go
Outdated
| if pi.PackageName != pj.PackageName { | ||
| if pi.PackageName < pj.PackageName { | ||
| return -1 | ||
| } | ||
| return 1 | ||
| } | ||
| if pi.PackageVersion != pj.PackageVersion { | ||
| if pi.PackageVersion < pj.PackageVersion { | ||
| return -1 | ||
| } | ||
| return 1 | ||
| } | ||
| if pi.PackageSPDXIdentifier < pj.PackageSPDXIdentifier { | ||
| return -1 | ||
| } else if pi.PackageSPDXIdentifier > pj.PackageSPDXIdentifier { | ||
| return 1 | ||
| } | ||
| return 0 |
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.
use cmp.Or, cmp.Compare
reporter/sbom/spdx.go
Outdated
| if urls, exists := packageToURLMap[pack.Name]; exists { | ||
| for _, url := range urls { | ||
| externalRefs = appendExternalRefs(externalRefs, categorySecurity, securityAdvisory, url) | ||
| } | ||
| } |
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.
If you are just looping through urls, you don't need to evaluate exists.
| if urls, exists := packageToURLMap[pack.Name]; exists { | |
| for _, url := range urls { | |
| externalRefs = appendExternalRefs(externalRefs, categorySecurity, securityAdvisory, url) | |
| } | |
| } | |
| for _, url := range packageToURLMap[pack.Name] { | |
| externalRefs = appendExternalRefs(externalRefs, categorySecurity, securityAdvisory, url) | |
| } |
|
Just a memo to save my brain memory. When report is executed twice, there will be an error in parsing spdx json files: Also, two files are created under For cdx format, no error happens but two extra strange files are created If we can not come up with a nice idea to fix these, It's acceptable for now, I think, they are "known bugs", isn't it? |
shino
left a comment
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.
The goal is in sight!
shino
left a comment
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.
Almost done! Some nitpicky comments added.
shino
left a comment
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.
Great feature! Thanks a lot!! 🍻 🍶 🍷 🥂
What did you implement:
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Checklist:
You don't have to satisfy all of the following.
make fmtmake testIs this ready for review?: YES
Reference