Skip to content

Commit

Permalink
fix bug#199 (guacsec#207)
Browse files Browse the repository at this point in the history
Signed-off-by: Nadgowda, Shripad <[email protected]>

Signed-off-by: Nadgowda, Shripad <[email protected]>
  • Loading branch information
nadgowdas authored Nov 9, 2022
1 parent 689cd3b commit 72a13f7
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions pkg/ingestor/parser/cyclonedx/parser_cyclonedx.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,20 @@ func (c *cyclonedxParser) CreateEdges(ctx context.Context, foundIdentities []ass

func (c *cyclonedxParser) addRootPackage(cdxBom *cdx.BOM) {
// oci purl: pkg:oci/debian@sha256%3A244fd47e07d10?repository_url=ghcr.io/debian&tag=bullseye
splitImage := strings.Split(cdxBom.Metadata.Component.Name, "/")
if len(splitImage) == 3 {
rootPackage := assembler.PackageNode{}
rootPackage.Purl = "pkg:oci/" + splitImage[2] + "?repository_url=" + splitImage[0] + "/" + splitImage[1]
rootPackage.Name = cdxBom.Metadata.Component.Name
rootPackage.Version = cdxBom.Metadata.Component.Version
rootPackage.Digest = append(rootPackage.Digest, cdxBom.Metadata.Component.Version)
rootPackage.Tags = []string{"CONTAINER"}
rootPackage.NodeData = *assembler.NewObjectMetadata(c.doc.SourceInformation)
c.rootPackage = parentPackages{
curPackage: rootPackage,
depPackages: []parentPackages{},
if cdxBom.Metadata.Component != nil {
splitImage := strings.Split(cdxBom.Metadata.Component.Name, "/")
if len(splitImage) == 3 {
rootPackage := assembler.PackageNode{}
rootPackage.Purl = "pkg:oci/" + splitImage[2] + "?repository_url=" + splitImage[0] + "/" + splitImage[1]
rootPackage.Name = cdxBom.Metadata.Component.Name
rootPackage.Version = cdxBom.Metadata.Component.Version
rootPackage.Digest = append(rootPackage.Digest, cdxBom.Metadata.Component.Version)
rootPackage.Tags = []string{"CONTAINER"}
rootPackage.NodeData = *assembler.NewObjectMetadata(c.doc.SourceInformation)
c.rootPackage = parentPackages{
curPackage: rootPackage,
depPackages: []parentPackages{},
}
}
}
}
Expand Down

0 comments on commit 72a13f7

Please sign in to comment.