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(rules): Add CVSS 3.1/4 to high vulnerability in dependency rule #193

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
10 changes: 8 additions & 2 deletions evaluator.rules.kts
Original file line number Diff line number Diff line change
Expand Up @@ -1546,10 +1546,16 @@ fun RuleSet.vulnerabilityWithHighSeverityInDependencyRule() = packageRule("HIGH_
-isProject()
-isExcluded()
+AnyOf(
hasVulnerability(maxAcceptedSeverity, "CVSS2") { value, threshold ->
hasVulnerability(maxAcceptedSeverity, "CVSS:2") { value, threshold ->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this would now disregard vulnerabilities that literally use "CVSS2" as the scoring system as we compare scoring systems by their strict string representation currently:

https://github.com/oss-review-toolkit/ort/blob/f560e02d555fd3b511d33b9d35cc4baa7de79ce8/evaluator/src/main/kotlin/PackageRule.kt#L98

Similar below. So this change likely has unwanted side effects.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll take a brief look at changing the hasVulnerability rule itself to address that.

value.toFloat() >= threshold.toFloat()
},
hasVulnerability(maxAcceptedSeverity, "CVSS3") { value, threshold ->
hasVulnerability(maxAcceptedSeverity, "CVSS:3") { value, threshold ->
value.toFloat() >= threshold.toFloat()
},
hasVulnerability(maxAcceptedSeverity, "CVSS:3.1") { value, threshold ->
value.toFloat() >= threshold.toFloat()
},
hasVulnerability(maxAcceptedSeverity, "CVSS:4.0") { value, threshold ->
value.toFloat() >= threshold.toFloat()
}
)
Expand Down