Skip to content

Commit e866bd5

Browse files
authored
fix(sbom): add check for CreationInfo to nil when detecting SPDX created using Trivy (aquasecurity#6346)
1 parent 1870f28 commit e866bd5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pkg/sbom/spdx/unmarshal.go

+4
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,10 @@ func (s *SPDX) parseExternalReferences(refs []*spdx.PackageExternalReference) (*
255255
}
256256

257257
func (s *SPDX) isTrivySBOM(spdxDocument *spdx.Document) bool {
258+
if spdxDocument == nil || spdxDocument.CreationInfo == nil || spdxDocument.CreationInfo.Creators == nil {
259+
return false
260+
}
261+
258262
for _, c := range spdxDocument.CreationInfo.Creators {
259263
if c.CreatorType == "Tool" && strings.HasPrefix(c.Creator, "trivy") {
260264
return true

0 commit comments

Comments
 (0)