mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-12 07:40:48 -08:00
fix(spdx): add workaround for no src packages (#4118)
This commit is contained in:
@@ -392,6 +392,9 @@ func (e *Marshaler) reportToCdxComponent(r types.Report) (*cdx.Component, error)
|
||||
component.BOMRef = p.ToString()
|
||||
component.PackageURL = p.ToString()
|
||||
}
|
||||
case ftypes.ArtifactVM:
|
||||
component.Type = cdx.ComponentTypeContainer
|
||||
component.BOMRef = e.newUUID().String()
|
||||
case ftypes.ArtifactFilesystem, ftypes.ArtifactRemoteRepository:
|
||||
component.Type = cdx.ComponentTypeApplication
|
||||
component.BOMRef = e.newUUID().String()
|
||||
|
||||
@@ -319,7 +319,7 @@ func (m *Marshaler) pkgToSpdxPackage(t, pkgDownloadLocation string, class types.
|
||||
}
|
||||
|
||||
var pkgSrcInfo string
|
||||
if class == types.ClassOSPkg {
|
||||
if class == types.ClassOSPkg && pkg.SrcName != "" {
|
||||
pkgSrcInfo = fmt.Sprintf("%s: %s %s", SourcePackagePrefix, pkg.SrcName, utils.FormatSrcVersion(pkg))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user