Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add package purl in VulnerabilityReport CRD #2311

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,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 @@ -231,6 +231,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 @@ -1437,6 +1437,8 @@ spec:
items:
type: string
type: array
packagePURL:
type: string
packagePath:
type: string
packageType:
Expand Down Expand Up @@ -2871,6 +2873,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
Loading