-
Notifications
You must be signed in to change notification settings - Fork 0
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: added adapter for osv scanner #35
Conversation
- osv scanner adapter generates KPIs by using the existing CveAdapter - Additional data models for osv detail results are provided, however they are not parsed by default to keep the parsing logic as small as possible to be robust against changes
|
Code Coverage
Files
|
import kotlinx.serialization.json.decodeFromStream | ||
|
||
object OsvAdapter { | ||
private val jsonParser = Json { |
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.
Is this something we can make global for the library, or should this be adapter specific?
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.
it might become adapter specific.
However, as long as the config is the same we could use a global object for that I guess. I'll consider this in a dedicated PR
@@ -91,9 +91,13 @@ object TrivyAdapter { | |||
val cvssData = it.cvss!!.values.map { jsonParser.decodeFromJsonElement<CVSSData>(it) } | |||
|
|||
val score = getHighestCvssScore(cvssData) | |||
val packageID = "${it.pkgName}@${it.installedVersion}" |
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.
that's a good change
|
||
@Test | ||
fun testResultDto() { | ||
Files.newInputStream(Path("src/test/resources/osv-scanner.json")).use { |
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.
what about the other test files?
Additionally, I extended the data format for
VulnerabilityDto
to explicitly contain aversion
string. From what I've seen all vulnerability scanners report this information and it is very important to understand the provided results.