-
Notifications
You must be signed in to change notification settings - Fork 84
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
Proposal: Supporting Maven registries #208
Comments
I think this makes sense, and here are a few things about this in my mind:
|
Note that there may also be different targets per version for one repository, on some Maven packages, e.g. |
100% agree. Perhaps it makes sense to add an optional field to the OSV payload to define a registry. eg.
Where the field missing would be equivalent to So, the downside to this approach would be that we could not have a single advisory which may apply to a coherent version range which was uploaded to multiple registries. |
It might be wise to think about this in larger context. It's not hard to imagine a universe where there are multiple registries (not just Java) hosting the same artifacts. Containers are another easy example here, there are many registries serving up the same content. It would be fair to set some boundaries, like the artifact name and version should be consistent across repositories I agree with @darakian, defining a registry as a URL would allow for flexibility and some future proofing |
I would like to give this a bump as it's become stale |
Thanks for the reminder @joshbressers ! Let me write out a more detailed consideration of all the possibilities here, and their implications for both vulnerability database maintainers and vulnerability scanners. Please let me know what everyone thinks on this! The main two alternatives are: 1. Add a
|
Another alternative which seems very in line with 'Option 2' would be to encode this information in It's unfortunate that |
@oliverchang I think Option 2 sounds sane. There's nothing we can pick that will make everyone happy, and option 2 should catch a lot of the current examples |
I think I prefer option 1 based on the aesthetics of it, but I don't have any real complaint about option 2. I do agree that we probably want to avoid having multiple registries on a single ecosystem where possible too. @chrisbloom7 do you have any thoughts? |
Summary:
Details:FWIW, the PURL way is to use a qualifier with the
If you are not adopting PURL, I would suggest at the minimum to keep similar names for similar concepts and use "repository_url" and not "registry". I would strongly advise against stuffing multiple attributes in a single field as in your solution 2. I would also suggest to look beyond Maven, as alternative repositories are common for RPMs, NuGet and other package types. But again, I would strongly suggest that you adopt PURL as a base, as many of the questions you have raised here and in #202 (for sources) may have been addressed in the spec and would best addressed in PURL otherwise. Each time you adopt a different naming convention and attribute names, you are effectively making it harder for users and the community: their SCA tools and SBOMs return PURLs and they need to add a (likely lossy) translation layer between these PURL data and OSV's. Not a happy thing IMHO.
The way you interact with any Maven repository is always the same, and each Maven repository does not define a new type of package, just a different base package repository URL, and IMHO never a different, new "ecosystem". |
Thanks for the feedback @pombredanne ! Re adopting PURL as the base, it would be a rather large breaking change for the schema. PURL is absolutely supported for interop, and https://osv.dev provides conversion between PURL and OSV types in both its re-exported entries and the API, to avoid conversion pain for users. Re fitting the attribute inside "ecosystem", it fits with our existing conventions in OSV for e.g. Linux distro ecosystems such as
Re alternate repositories in general, as discussed in #208 (comment) it seems like for the vast majority of ecosystems, vulnerability databases would be unlikely to encode vulnerabilities outside of the main default registries. Maven happens to be an outlier, because of large alternative registries such as https://repo.jenkins-ci.org/releases/ or https://maven.google.com/ Are there examples in other such ecosystems? That would make a stronger case for adding e.g. |
I also advocated for We've already encountered situations where only one them is actually malicious/vulnerable while the others were not. Vulnerabilities for specific architectures or OSs also come up. Also, some Maven packages for Scala have builds for different targets, e.g https://mvnrepository.com/artifact/co.fs2/fs2-io Though all of that could get resolved with a binary artifact field the as discussed in #202. PURLs would perhaps allow encoding ecosystem specific information such as affected functions for crates, or affected imports and paths for Go, if that seems of interest. |
I'm aligned with @oliverchang here. I don't see a reason to make defining an alternate source of packages more complicated than it needs to be. PURLs would also be inconsistent with any advisories which apply to a range of packages rather than to a single specific version.
Each Maven package registry does define a new package namespace though and that needs to be accounted for. |
I'm not too opposed to other solutions but I guess what we are worried about is that any new issues that pop up will necessitate further additions and new fields to the format. The PURL seems like a natural choice since it is designed to be 'ecosystem specific' in a way and it already exists in the schema. Note that to resolve both this issue and #202, alterations need to be made to the
A PURL can identify a package only, the version component is optional. It is effectively the same solution as Option 1 or 2, just encoded differently. There are other challenges in using the purl field tho, since it is currently optional. And there would need to be some kind of implicit defaults for every ecosystem. |
Thank you all for the feedback re PURL. While the OSV-Schema absolutely supports PURL for interop (as discussed in #208 (comment)), it's not possible to move to PURL as the source of truth for identifying packages without a large breaking change requiring migration from the current data providers. There are also certain underspecified parts in the PURL spec (e.g. package-url/purl-spec#247) that would have to be resolved. I'll open a PR for option 2 of #208 (comment) shortly. I'm not seeing any answers/examples of other ecosystems that would point to the necessity of a |
Fixes #208. Signed-off-by: Oliver Chang <[email protected]>
Fixes #208. --------- Signed-off-by: Oliver Chang <[email protected]> Signed-off-by: Oliver Chang <[email protected]>
The current Maven ecosystem definition is "The Maven Java package ecosystem. The name field is a Maven package name.", which is a little vague.
We should clarify that this is referring to Maven Central by default, and if a different registry is required, allow the ecosystem to be "Maven:", similar to the Linux distro definitions (e.g. "Debian:7").
The default (Maven Central) should always be used/preferred where it makes sense.
The text was updated successfully, but these errors were encountered: