Skip to content

Commit

Permalink
feat: add package purl in vuln report (#2311)
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Hoehl <[email protected]>
Co-authored-by: Lukas Hoehl <[email protected]>
  • Loading branch information
hown3d and Lukas Hoehl authored Nov 21, 2024
1 parent 1880d76 commit fadc65c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ spec:
items:
type: string
type: array
packagePURL:
type: string
packagePath:
type: string
packageType:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ spec:
items:
type: string
type: array
packagePURL:
type: string
packagePath:
type: string
packageType:
Expand Down
4 changes: 4 additions & 0 deletions deploy/static/trivy-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1441,6 +1441,8 @@ spec:
items:
type: string
type: array
packagePURL:
type: string
packagePath:
type: string
packageType:
Expand Down Expand Up @@ -2879,6 +2881,8 @@ spec:
items:
type: string
type: array
packagePURL:
type: string
packagePath:
type: string
packageType:
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/aquasecurity/v1alpha1/vulnerability_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ type Vulnerability struct {
Class string `json:"class,omitempty"`
PackageType string `json:"packageType,omitempty"`
PkgPath string `json:"packagePath,omitempty"`
PkgPURL string `json:"packagePURL,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
4 changes: 4 additions & 0 deletions pkg/vulnerabilityreport/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ func GetVulnerabilitiesFromScanResult(report ty.Result, addFields AdditionalFiel
Score: GetScoreFromCVSS(GetCvssV3(sr.CVSS)),
}

if sr.PkgIdentifier.PURL != nil {
vulnerability.PkgPURL = sr.PkgIdentifier.PURL.String()
}

if addFields.Description {
vulnerability.Description = sr.Description
}
Expand Down

0 comments on commit fadc65c

Please sign in to comment.