Skip to content

Commit 164c160

Browse files
authored
Merge pull request #1135 from fabriziosestito/feat/add-severity-source
feat: add SeveritySource to VulnerabilityReport
2 parents f9a96cb + dcb2c79 commit 164c160

17 files changed

Lines changed: 410 additions & 3 deletions

api/storage/v1alpha1/vulnerabilityreport_types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ type Vulnerability struct {
131131
// Severity rating (e.g., "HIGH", "MEDIUM")
132132
Severity string `json:"severity" protobuf:"bytes,10,req,name=severity"`
133133

134+
// SeveritySource identifies the vendor that produced the Severity
135+
// (e.g. "nvd", "ghsa", "redhat", "alpine").
136+
// Consumers can use this key to look up the matching entry in the CVSS map to display alongside Severity.
137+
// May be empty when the source vendor is not known.
138+
SeveritySource string `json:"severitySource,omitempty" protobuf:"bytes,16,opt,name=severitySource"`
139+
134140
// References contains URLs for more information
135141
References []string `json:"references,omitempty" protobuf:"bytes,11,rep,name=references"`
136142

docs/crds/CRD-docs-for-docs-repo.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -970,6 +970,10 @@ so we have to restore it. + | |
970970
| *`diffID`* __string__ | DiffID of the image layer where the vulnerability was introduced + | |
971971
| *`description`* __string__ | Description of the vulnerability + | |
972972
| *`severity`* __string__ | Severity rating (e.g., "HIGH", "MEDIUM") + | |
973+
| *`severitySource`* __string__ | SeveritySource identifies the vendor that produced the Severity +
974+
(e.g. "nvd", "ghsa", "redhat", "alpine"). +
975+
Consumers can use this key to look up the matching entry in the CVSS map to display alongside Severity. +
976+
May be empty when the source vendor is not known. + | |
973977
| *`references`* __string array__ | References contains URLs for more information + | |
974978
| *`cvss`* __object (keys:string, values:xref:{anchor_prefix}-github-com-kubewarden-sbomscanner-api-storage-v1alpha1-cvss[$$CVSS$$])__ | CVSS scoring details + | |
975979
| *`cwes`* __string array__ | CWEs with which the CVE is classified + | |

docs/crds/CRD-docs-for-docs-repo.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,7 @@ _Appears in:_
742742
| `diffID` _string_ | DiffID of the image layer where the vulnerability was introduced | | |
743743
| `description` _string_ | Description of the vulnerability | | |
744744
| `severity` _string_ | Severity rating (e.g., "HIGH", "MEDIUM") | | |
745+
| `severitySource` _string_ | SeveritySource identifies the vendor that produced the Severity<br />(e.g. "nvd", "ghsa", "redhat", "alpine").<br />Consumers can use this key to look up the matching entry in the CVSS map to display alongside Severity.<br />May be empty when the source vendor is not known. | | |
745746
| `references` _string array_ | References contains URLs for more information | | |
746747
| `cvss` _object (keys:string, values:[CVSS](#cvss))_ | CVSS scoring details | | |
747748
| `cwes` _string array_ | CWEs with which the CVE is classified | | |

internal/handlers/trivyreport/trivy.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ func newVulnerability(trivyVuln trivyTypes.DetectedVulnerability) storagev1alpha
8686
DiffID: trivyVuln.Layer.DiffID,
8787
Description: trivyVuln.Description,
8888
Severity: trivyVuln.Severity,
89+
SeveritySource: string(trivyVuln.SeveritySource),
8990
References: trivyVuln.References,
9091
CVSS: newCVSS(trivyVuln.CVSS),
9192
CWEs: trivyVuln.CweIDs,

internal/handlers/trivyreport/trivy_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,10 @@ func TestNewResultsFromTrivyReport(t *testing.T) {
6868
FixedVersions: []string{
6969
"0.36.0",
7070
},
71-
DiffID: "sha256:d37a3e42d123ca619ceab4bbe3c1e9a96d0a837e5e0e3052b33dbd0e842c5661",
72-
Description: "Lorem ipsum",
73-
Severity: storagev1alpha1.SeverityMedium,
71+
DiffID: "sha256:d37a3e42d123ca619ceab4bbe3c1e9a96d0a837e5e0e3052b33dbd0e842c5661",
72+
Description: "Lorem ipsum",
73+
Severity: storagev1alpha1.SeverityMedium,
74+
SeveritySource: "ghsa",
7475
References: []string{
7576
"http://www.openwall.com/lists/oss-security/2025/03/07/2",
7677
"https://access.redhat.com/security/cve/CVE-2025-22870",

pkg/generated/applyconfiguration/storage/v1alpha1/vulnerability.go

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/generated/openapi/zz_generated.openapi.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/crd/storage.sbomscanner.kubewarden.io_vulnerabilityreports.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,13 @@ spec:
163163
severity:
164164
description: Severity rating (e.g., "HIGH", "MEDIUM")
165165
type: string
166+
severitySource:
167+
description: |-
168+
SeveritySource identifies the vendor that produced the Severity
169+
(e.g. "nvd", "ghsa", "redhat", "alpine").
170+
Consumers can use this key to look up the matching entry in the CVSS map to display alongside Severity.
171+
May be empty when the source vendor is not known.
172+
type: string
166173
suppressed:
167174
description: |-
168175
Suppressed identify when vulnerability has

test/crd/storage.sbomscanner.kubewarden.io_workloadscanreports.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,13 @@ spec:
189189
description: Severity rating (e.g., "HIGH",
190190
"MEDIUM")
191191
type: string
192+
severitySource:
193+
description: |-
194+
SeveritySource identifies the vendor that produced the Severity
195+
(e.g. "nvd", "ghsa", "redhat", "alpine").
196+
Consumers can use this key to look up the matching entry in the CVSS map to display alongside Severity.
197+
May be empty when the source vendor is not known.
198+
type: string
192199
suppressed:
193200
description: |-
194201
Suppressed identify when vulnerability has

0 commit comments

Comments
 (0)