Skip to content

Commit cb36eb6

Browse files
committed
fixup! refactor(advisor)!: Change advisor semantics to maintain scoring vectors
1 parent 2b740a2 commit cb36eb6

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

model/src/test/kotlin/AdvisorResultTest.kt

+6-2
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ private const val DEFAULT_SCORING_SYSTEM = "cvssv3.1_qr"
286286
/** The default severity assigned to vulnerabilities. */
287287
private const val DEFAULT_SEVERITY = "MODERATE"
288288

289+
/** The default score assigned to vulnerabilities. */
290+
private const val DEFAULT_SCORE = 5.0
291+
289292
/** Test package identifiers. */
290293
private val langId = Identifier("Maven", "org.apache.commons", "commons-lang3", "3.8")
291294
private val queryId = Identifier("NPM", "", "jQuery", "2.1.4")
@@ -298,12 +301,13 @@ private fun createVulnerability(
298301
id: String,
299302
uriPrefix: String = DEFAULT_URI_PREFIX,
300303
scoringSystem: String = DEFAULT_SCORING_SYSTEM,
301-
severity: String = DEFAULT_SEVERITY
304+
severity: String = DEFAULT_SEVERITY,
305+
score: Double = DEFAULT_SCORE
302306
): Vulnerability =
303307
Vulnerability(
304308
id = id,
305309
references = listOf(
306-
VulnerabilityReference(URI("$uriPrefix$id"), scoringSystem, severity)
310+
VulnerabilityReference(URI("$uriPrefix$id"), scoringSystem, severity, score)
307311
)
308312
)
309313

plugins/advisors/nexus-iq/src/main/kotlin/NexusIq.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ class NexusIq(override val descriptor: PluginDescriptor, private val config: Nex
156156
val references = mutableListOf<VulnerabilityReference>()
157157

158158
val browseUrl = URI("${config.browseUrl}/assets/index.html#/vulnerabilities/$reference")
159-
val nexusIqReference = VulnerabilityReference(browseUrl, scoringSystem(), severity = null, severity.toDouble())
159+
val nexusIqReference = VulnerabilityReference(browseUrl, scoringSystem(), threatCategory, severity.toDouble())
160160

161161
references += nexusIqReference
162162
url.takeIf { it != browseUrl }?.let { references += nexusIqReference.copy(url = it) }

plugins/advisors/oss-index/src/test/kotlin/OssIndexTest.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,13 @@ class OssIndexTest : WordSpec({
9797
"&utm_content=5.0"
9898
),
9999
scoringSystem = "CVSS:3.0",
100-
severity = "MEDIUM",
100+
severity = "CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N",
101101
score = 5.5
102102
),
103103
VulnerabilityReference(
104104
url = URI("https://nvd.nist.gov/vuln/detail/CVE-2020-15250"),
105105
scoringSystem = "CVSS:3.0",
106-
severity = "MEDIUM",
106+
severity = "CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N",
107107
score = 5.5
108108
)
109109
)

0 commit comments

Comments
 (0)