-
Notifications
You must be signed in to change notification settings - Fork 309
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
fix(vulnerable-code): Fix search for Go package vulnerabilities #9299
fix(vulnerable-code): Fix search for Go package vulnerabilities #9299
Conversation
Nit: Missing period at the end of the sentence. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #9299 +/- ##
============================================
+ Coverage 66.29% 67.49% +1.19%
+ Complexity 1201 1200 -1
============================================
Files 239 241 +2
Lines 8446 8493 +47
Branches 905 899 -6
============================================
+ Hits 5599 5732 +133
+ Misses 2478 2399 -79
+ Partials 369 362 -7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
plugins/advisors/vulnerable-code/src/main/kotlin/VulnerableCode.kt
Outdated
Show resolved
Hide resolved
plugins/advisors/vulnerable-code/src/main/kotlin/VulnerableCode.kt
Outdated
Show resolved
Hide resolved
2ce18f6
to
c7861a8
Compare
c7861a8
to
e82d9aa
Compare
e82d9aa
to
b4587a3
Compare
This is about namespace segments?
I ask myself if there is not a general problem in detecting
Because the github.com home of quic-go is https://github.com/quic-go and quic-go is just one of the subprojects there. |
Yes, that's exactly what my PR is about. But could be that there's still something wrong in my implementation. |
Possibly I did not know enough when I wroted the posting on Friday. Because I am not a Go programmer, I don't even know if there exists a concept of namespaces. Nevertheless I proposed to use the namespace, based on some directory structure on a github.com account. I don't know if this is valid, or if it is better to say something like "There are no namespaces in Go". Don't know. |
You may want to refer to this comment. |
I still believe we should solve this differently, in a more generic way. While Go apparently does not have namespaces, the purl standard treats them as if Go had namespaces. I'm currently preparing a fix for that. |
Related OSV code locations:
|
For Go packages, both the namespace and name may contain path segments separated by a "/" character. The purl specification requires these "/" characters to be percent-encoded in the namespace and name components of a purl. The VulnerableCode bulk-search API is unable to handle these percent-encoded "/" characters, resulting in no vulnerability records being returned. This bugfix decodes any percent-encoded "/" characters just before making the VulnerableCode query to ensure proper functionality. Fixes oss-review-toolkit#9298. Signed-off-by: Wolfgang Klenk <[email protected]>
b4587a3
to
6f5a942
Compare
@sschuberth I added a test cases, hoping that this is what you had in mind. It will start to fail once the slashes in the purl name section are no longer percent-encoded. Once this test fails, this commit can be cherry-picked and removed. |
Hmm, not really. I was hoping for a funTest that queries VC for a Go package which is known to have vulnerabilities. When run against |
Nevermind @wkl3nk, I'll now add such a test myself as I'm close to proposing a more generic fix. |
Closing in favor of the more generic solution in #9330. |
For Go packages, both the namespace and name may contain path segments separated by a "/" character. The purl specification requires these "/" characters to be percent-encoded in the namespace and name components of a purl.
The VulnerableCode bulk-search API is unable to handle these percent-encoded "/" characters, resulting in no vulnerability records being returned.
This bugfix decodes any percent-encoded "/" characters just before making the VulnerableCode query to ensure proper functionality.
Fixes #9298