Skip to content

Commit 2825504

Browse files
committed
feat(osv): Enable querying vulnerabilities for the SwiftURL ecosystem
Since the package identifiers in OSV's vulnerability data for the SwiftURL ecosystem have become consistent [1], it is now clear how to construct the requests. Simply add the missing mapping and a test to enable retrieving vulnerabilities for Swift packages. Fixes #7841. [1] google/osv.dev#1923 (comment) Signed-off-by: Frank Viernau <[email protected]>
1 parent 740b7d6 commit 2825504

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

clients/osv/src/main/kotlin/Model.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ object Ecosystem {
119119
const val PUB = "Pub"
120120
const val PYPI = "PyPI"
121121
const val RUBY_GEMS = "RubyGems"
122+
const val SWIFT_URL = "SwiftURL"
122123
}
123124

124125
@Serializable(EventSerializer::class)

plugins/advisors/osv/src/funTest/kotlin/OsvFunTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ class OsvFunTest : StringSpec({
4848
"NPM::rebber:1.0.0",
4949
"NuGet::Bunkum:4.0.0",
5050
"Pub::http:0.13.1",
51-
"PyPI::django:3.2"
51+
"PyPI::django:3.2",
52+
"Swift::github.com/apple/swift-nio:2.41.0"
5253
).mapTo(mutableSetOf()) {
5354
identifierToPackage(it)
5455
}

plugins/advisors/osv/src/main/kotlin/Osv.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ private fun createRequest(pkg: Package): VulnerabilitiesForPackageRequest? {
159159
"Maven" -> Ecosystem.MAVEN
160160
"Pub" -> Ecosystem.PUB
161161
"PyPI" -> Ecosystem.PYPI
162+
"Swift" -> Ecosystem.SWIFT_URL
162163
else -> null
163164
}
164165

0 commit comments

Comments
 (0)