Skip to content
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

Support for packageurl #64

Closed
sameer1046 opened this issue Feb 11, 2021 · 8 comments · Fixed by #279
Closed

Support for packageurl #64

sameer1046 opened this issue Feb 11, 2021 · 8 comments · Fixed by #279
Assignees

Comments

@sameer1046
Copy link

sameer1046 commented Feb 11, 2021

Support to identify package with package url would be nice and it will be easy to integrate with other tool chain.
https://github.com/package-url/purl-spec

@pombredanne
Copy link
Contributor

I could not agree more!

@oliverchang
Copy link
Collaborator

Hi!

Could I ask where you are suggesting to add support for purls? As part of an API query?

Our thinking with our current schema and API is to keep it compatible with PURLs where we can, i.e. keeping the "ecosystem" values consistent with the ones chosen by purl ("golang", "pypi" etc), so that in most cases you can just split the PURL into the ecosystem name and the package path and version and still have it accepted by OSV.

@sameer1046
Copy link
Author

sameer1046 commented Feb 26, 2021

That is correct. But if purl will be supported in api query then it will be easily integrated with other open source tools like owasp dependency track, nexb vulnerable code

@oliverchang
Copy link
Collaborator

We support PURL API requests now:

curl -X POST -d '{"package": {"purl": "pkg:maven/org.apache.struts:struts2-core"}, "version": "2.0.14"}' https://api.osv.dev/v1/query

But @VinodAnandan pointed out that we don't support package URLs with versions in them. e.g. "pkg:maven/org.apache.struts:[email protected]". Re-opening to consider this feature.

@oliverchang oliverchang reopened this Feb 13, 2022
@nscuro
Copy link

nscuro commented Feb 15, 2022

First, thank you for implementing PURL support! 🚀

In addition to the missing version though, the PURL syntax isn't quite right yet either (for Maven packages).

PURL is defined as:

scheme:type/namespace/name@version?qualifiers#subpath

For the maven type, groupId maps to namespace and artifactId to name, see here. So the correct PURL for the example above would be:

pkg:maven/org.apache.struts/struts2-core

Currently, the following does not yield any results:

$ curl -X POST -d '{"package": {"purl": "pkg:maven/org.apache.struts/struts2-core"}, "version": "2.0.14"}' https://api.osv.dev/v1/query

oliverchang added a commit that referenced this issue Feb 16, 2022
PURL uses '/' as a separator between group ID and artifact ID.

Part of #64.
@oliverchang
Copy link
Collaborator

Thanks for pointing that out @nscuro. I have a PR out and this should be fixed shortly.

Querying by PURLs that have versions in them will also come shortly.

oliverchang added a commit that referenced this issue Feb 16, 2022
PURL uses '/' as a separator between group ID and artifact ID.

Part of #64.
oliverchang added a commit that referenced this issue Feb 17, 2022
oliverchang added a commit that referenced this issue Feb 17, 2022
oliverchang added a commit that referenced this issue Feb 17, 2022
@oliverchang
Copy link
Collaborator

curl -X POST -d '{"package": {"purl": "pkg:maven/org.apache.struts/[email protected]"}}' https://api.osv.dev/v1/query now works!

@VinodAnandan
Copy link

Thank you @oliverchang !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants