mirror of
https://github.com/anchore/syft.git
synced 2025-11-18 00:43:20 +01:00
* [CycloneDX] Add artifactID and groupID to the cycloneDX properties Signed-off-by: Peter Balogh <p.balogh.sa@gmail.com> * update comment Signed-off-by: Peter Balogh <p.balogh.sa@gmail.com> * additional checks for value Signed-off-by: Peter Balogh <p.balogh.sa@gmail.com> * fill group filed with groupID in the case of Java Signed-off-by: Peter Balogh <p.balogh.sa@gmail.com> * fix linter warning Signed-off-by: Alex Goodman <alex.goodman@anchore.com> Co-authored-by: Alex Goodman <alex.goodman@anchore.com>
28 lines
698 B
Go
28 lines
698 B
Go
package cyclonedxhelpers
|
|
|
|
import (
|
|
"github.com/CycloneDX/cyclonedx-go"
|
|
"github.com/anchore/syft/syft/pkg"
|
|
)
|
|
|
|
func Component(p pkg.Package) cyclonedx.Component {
|
|
return cyclonedx.Component{
|
|
Type: cyclonedx.ComponentTypeLibrary,
|
|
Name: p.Name,
|
|
Group: Group(p),
|
|
Version: p.Version,
|
|
PackageURL: p.PURL,
|
|
Licenses: Licenses(p),
|
|
CPE: CPE(p),
|
|
Author: Author(p),
|
|
Publisher: Publisher(p),
|
|
Description: Description(p),
|
|
ExternalReferences: ExternalReferences(p),
|
|
Properties: Properties(p),
|
|
}
|
|
}
|
|
|
|
func hasMetadata(p pkg.Package) bool {
|
|
return p.Metadata != nil
|
|
}
|