Skip to content

Commit 366b3db

Browse files
committed
fix(rules): Adjust to the new vulnerability API
See [1]. [1]: oss-review-toolkit/ort#9091 Signed-off-by: Sebastian Schuberth <[email protected]>
1 parent e74d2ed commit 366b3db

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

evaluator.rules.kts

+4-8
Original file line numberDiff line numberDiff line change
@@ -1540,24 +1540,20 @@ fun RuleSet.vulnerabilityInDependencyRule() = packageRule("VULNERABILITY_IN_DEPE
15401540
}
15411541

15421542
fun RuleSet.vulnerabilityWithHighSeverityInDependencyRule() = packageRule("HIGH_SEVERITY_VULNERABILITY_IN_DEPENDENCY") {
1543-
val maxAcceptedSeverity = "5.0"
1543+
val scoreThreshold = 5.0f
15441544

15451545
require {
15461546
-isProject()
15471547
-isExcluded()
15481548
+AnyOf(
1549-
hasVulnerability(maxAcceptedSeverity, "CVSS2") { value, threshold ->
1550-
value.toFloat() >= threshold.toFloat()
1551-
},
1552-
hasVulnerability(maxAcceptedSeverity, "CVSS3") { value, threshold ->
1553-
value.toFloat() >= threshold.toFloat()
1554-
}
1549+
hasVulnerability(scoreThreshold, "CVSS2"),
1550+
hasVulnerability(scoreThreshold, "CVSS3")
15551551
)
15561552
}
15571553

15581554
error(
15591555
"The package '${pkg.metadata.id.toCoordinates()}' has a vulnerability score greater than or equal to " +
1560-
"$maxAcceptedSeverity.",
1556+
"$scoreThreshold.",
15611557
howToFixDefault()
15621558
)
15631559
}

0 commit comments

Comments
 (0)