-
Notifications
You must be signed in to change notification settings - Fork 363
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 PURLToPackage function and move it #439
Conversation
// Debian and Alpine repeats their namespace in PURL, so don't add it to the name | ||
name = parsedPURL.Name | ||
default: | ||
name = parsedPURL.Namespace + "/" + parsedPURL.Name |
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 definitely the case in all other ecosystems?
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.
I'm pretty sure this is the case for all other ecosystems in osv right now, going by the package_to_purl function in python:
If we add more linux distros we'll also need to remove the namespace for them as well.
Turns out our
PURLToPackage
function was returning incorrect results for ecosystems that contain a namespace like golang, the returned result was simply missing the full namespace (github.com/author/...). When adding the namespace, there's also some exceptions with some ecosystems (e.g. Maven uses:
, debian and alpine repeats their name in their namespace, etc).This also moves the
PURLToPackage
to themodels
package instead ofosvscanner
, deprecating the existing one inosvscanner
because:model
.Also added additional tests to clarify behavior and prevent regressions in the future.