-
Notifications
You must be signed in to change notification settings - Fork 317
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
Black Duck: Add a mechanism to set the origin-id for a package via a label curation. #9819
Conversation
2fdc0d5
to
3df3785
Compare
plugins/advisors/black-duck/src/funTest/kotlin/ResponseCachingComponentServiceClient.kt
Fixed
Show fixed
Hide fixed
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #9819 +/- ##
=========================================
Coverage 68.07% 68.07%
Complexity 1285 1285
=========================================
Files 249 249
Lines 8828 8828
Branches 918 918
=========================================
Hits 6010 6010
Misses 2432 2432
Partials 386 386
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
3df3785
to
99cae52
Compare
val index = coordinates.indexOf(':') | ||
require(index != -1) { | ||
"Could not parse originId '$coordinates'. Missing ':' separator ." | ||
} | ||
|
||
return BlackDuckOriginId( | ||
externalNamespace = coordinates.substring(0, index), | ||
externalId = coordinates.substring(index + 1, coordinates.length) | ||
) |
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.
Alternatively:
val parts = coordinates.split(':', limit = 2)
require(parts.size == 2) {
"Could not parse originId '$coordinates'. Missing ':' separator ."
}
return BlackDuckOriginId(externalNamespace = parts[0], externalId = parts[1])
Prepare for adding a test for querying by origin-id. Signed-off-by: Frank Viernau <x9fviern@zeiss.com>
99cae52
to
5234a50
Compare
By default, the vulnerabilities are queried by the respective purl. This does not work in all cases, e.g.: 1. Some origins do not (yet) have a purl associated. 2. For some ecosystem, querying by purl doesn't work, even though the data sets have a purl. 3. The knowledge base may not contain a data set for the exact package but for the same "package" in a different ecosystem. For example, query vulnerabilities for the "ubuntu" package instead of for the "github" package. So, allow to set the origin-id via a package label curation, to override the origin for which the vulnerabilities shall be retrieved. Note: Since the amount of external namespaces is rather large, test the querying only for a few ecosystems. This should be fine, because there is very little namespace specific logic in ORT's code involved. Signed-off-by: Frank Viernau <x9fviern@zeiss.com>
5234a50
to
44c9067
Compare
See individual commits.
Part of: #8739.