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

advisors/black-duck: CVSS2 parsing fixes #9855

Merged
merged 6 commits into from
Jan 29, 2025
Merged

Conversation

fviernau
Copy link
Member

@fviernau fviernau commented Jan 29, 2025

See individual commits.

Part of: #8739.

@fviernau fviernau requested a review from a team as a code owner January 29, 2025 08:09
@fviernau fviernau enabled auto-merge (rebase) January 29, 2025 08:10
@fviernau fviernau force-pushed the black-duck-cvss2-parsing-fixes branch from 3d7382b to b23f029 Compare January 29, 2025 08:11
@fviernau fviernau force-pushed the black-duck-cvss2-parsing-fixes branch 2 times, most recently from 6123743 to e665687 Compare January 29, 2025 08:16
Signed-off-by: Frank Viernau <x9fviern@zeiss.com>
@fviernau fviernau force-pushed the black-duck-cvss2-parsing-fixes branch from e665687 to 691caa4 Compare January 29, 2025 08:28
Copy link

codecov bot commented Jan 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.12%. Comparing base (c15996b) to head (9898a44).
Report is 8 commits behind head on main.

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           
Flag Coverage Δ
funTest-docker 65.14% <ø> (ø)
funTest-non-docker 33.37% <ø> (ø)
test-ubuntu-24.04 35.76% <ø> (ø)
test-windows-2022 35.73% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fviernau fviernau force-pushed the black-duck-cvss2-parsing-fixes branch from 691caa4 to ec9bdc1 Compare January 29, 2025 09:01
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>
@fviernau fviernau force-pushed the black-duck-cvss2-parsing-fixes branch from ec9bdc1 to 59bb47d Compare January 29, 2025 09:03
@fviernau fviernau requested a review from sschuberth January 29, 2025 09:04
@@ -220,6 +224,18 @@ internal fun VulnerabilityView.toOrtVulnerability(): Vulnerability {
)
}

private fun VulnerabilityCvss3View.getScoringSystemAndVector(): Pair<String, String> {
val scoringSystem = vector.substringBefore('/', "").ifEmpty { Cvss3Rating.PREFIXES.first() }

Copy link
Member

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>
@fviernau fviernau force-pushed the black-duck-cvss2-parsing-fixes branch from 59bb47d to 9898a44 Compare January 29, 2025 13:17
@fviernau fviernau requested a review from sschuberth January 29, 2025 13:23
@fviernau fviernau merged commit 5629cd5 into main Jan 29, 2025
26 checks passed
@fviernau fviernau deleted the black-duck-cvss2-parsing-fixes branch January 29, 2025 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants