-
Notifications
You must be signed in to change notification settings - Fork 318
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
advisors/black-duck: CVSS2 parsing fixes #9855
Conversation
3d7382b
to
b23f029
Compare
6123743
to
e665687
Compare
Signed-off-by: Frank Viernau <x9fviern@zeiss.com>
e665687
to
691caa4
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #9855 +/- ##
=========================================
Coverage 68.12% 68.12%
Complexity 1292 1292
=========================================
Files 250 250
Lines 8840 8840
Branches 917 917
=========================================
Hits 6022 6022
Misses 2431 2431
Partials 387 387
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
691caa4
to
ec9bdc1
Compare
Signed-off-by: Frank Viernau <x9fviern@zeiss.com>
Avoid recomputing the values and reduce the nesting level. Signed-off-by: Frank Viernau <x9fviern@zeiss.com>
Signed-off-by: Frank Viernau <x9fviern@zeiss.com>
This illustrates an issue with parsing the `vector` and `scoring_system`. Signed-off-by: Frank Viernau <x9fviern@zeiss.com>
ec9bdc1
to
59bb47d
Compare
@@ -220,6 +224,18 @@ internal fun VulnerabilityView.toOrtVulnerability(): Vulnerability { | |||
) | |||
} | |||
|
|||
private fun VulnerabilityCvss3View.getScoringSystemAndVector(): Pair<String, String> { | |||
val scoringSystem = vector.substringBefore('/', "").ifEmpty { Cvss3Rating.PREFIXES.first() } | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider dropping this empty line now to visually align with the function below.
The resulting `vector` parsed from a given CVSS2 data structure accidentally kept surrounding braces. Furthermore, extracting the `scoringSystem` via `substringBefore('/')` gave wrong results, because a CVSS2 vector does not have such a scoring system prefix at all, but contains slashes, see also the diff in `CVE-2015-3996-parsed.yml`. Signed-off-by: Frank Viernau <x9fviern@zeiss.com>
59bb47d
to
9898a44
Compare
See individual commits.
Part of: #8739.