-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
fix(sbom): fix panic when scanning SBOM file without root component into SBOM format #7051
fix(sbom): fix panic when scanning SBOM file without root component into SBOM format #7051
Conversation
pkg/sbom/io/encode.go
Outdated
@@ -86,7 +86,10 @@ func (e *Encoder) rootComponent(r types.Report) (*core.Component, error) { | |||
case artifact.TypeCycloneDX, artifact.TypeSPDX: | |||
// When we scan SBOM file | |||
if r.BOM != nil { | |||
return r.BOM.Root(), nil | |||
// If SBOM file doesn't contain root component - use filesystem | |||
if bomRoot := r.BOM.Root(); bomRoot != nil { |
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 bomRoot := r.BOM.Root(); bomRoot != nil { | |
if r.BOM != nil && rBOM.Root() != nil { | |
return r.BOM.Root(), nil |
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.
updated in c4c413a
Name: "org.apache.logging.log4j:log4j-core", | ||
Version: "2.23.1", | ||
Identifier: ftypes.PkgIdentifier{ | ||
UID: "6C0AE96901617503", |
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.
Is it needed? UID is not used in encode.go for now.
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.
oh.. right. Thanks!
It looks like I accidentally copied Report
for testcase from PR where we add UID 😄
Removed in 9afe959
…e/fix-panic-when-there-is-no-root
Description
See #7050
Related issues
metadata.component
into SBOM format #7050Checklist