Skip to content

Commit

Permalink
fix(reporter): Add score and method properties in CycloneDX report
Browse files Browse the repository at this point in the history
Signed-off-by: George Andrinopoulos <[email protected]>
  • Loading branch information
geoandri authored and sschuberth committed Nov 2, 2023
1 parent 7c0ca7c commit 1f2ad1e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,9 @@
"source": {
"url": "https://cves.example.org/cve1"
},
"severity": "medium"
"score": 6.0,
"severity": "medium",
"method": "CVSSv2"
}
],
"description": "A vulnerability description",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@
<source>
<url>https://cves.example.org/cve1</url>
</source>
<score>6.0</score>
<severity>medium</severity>
<method>CVSSv2</method>
</rating>
</ratings>
<description>A vulnerability description</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,9 @@ class CycloneDxReporter : Reporter {
.apply { url = reference.url.toString() }
severity = org.cyclonedx.model.vulnerability.Vulnerability.Rating.Severity
.fromString(reference.severityRating.lowercase())
score = reference.severity?.toDoubleOrNull()
method = org.cyclonedx.model.vulnerability.Vulnerability.Rating.Method
.fromString(reference.scoringSystem)
}
}
affects = mutableListOf(
Expand Down
2 changes: 1 addition & 1 deletion reporter/src/testFixtures/kotlin/TestData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ val VULNERABILITY = Vulnerability(
summary = "A vulnerability summary",
description = "A vulnerability description",
references = listOf(
VulnerabilityReference(URI("https://cves.example.org/cve1"), "Cvss2", "6.0")
VulnerabilityReference(URI("https://cves.example.org/cve1"), "CVSSv2", "6.0")
)
)

Expand Down

0 comments on commit 1f2ad1e

Please sign in to comment.