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

feat(API): update version matching for NuGet, PyPI and RubyGems #2971

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hogo6002
Copy link
Contributor

@hogo6002 hogo6002 commented Dec 10, 2024

Malicious package publishes OSV records for crates.io, npm, NuGet, PyPI, and RubyGems. Queries for NuGet, PyPI, and RubyGems (npm and crates.io use semantic versioning, so the matching process is different) only match vulnerabilities against specific affected versions. However, malicious package records may only provide affected ranges instead of individual versions in some cases (e.g. https://api.osv.dev/v1/vulns/MAL-2022-7426). OSV also can't enumerate affected versions for a malicious package as those versions have been deleted. This causes issues like #2407

Switching the API query version matching from _query_by_generic_version() to _query_by_comparing_versions() can address this issue. The _query_by_comparing_versions() function matches both affected versions and affected ranges, but might slow down the performance for a bit.

Adding this PR after the end-of-year release to give more time to verify performance on the test instance before rolling out to prod.

@hogo6002 hogo6002 changed the title feat(API): switch malicious package matching logic feat(API): improve malicious package matching Dec 10, 2024
@another-rex
Copy link
Contributor

Can you update the title to be more about switching the 3 ecosystems to the new matching method? While this change is motivated by improving Malicious package matching, the actual change will primarily affects normal matching as well (if I understand correctly), would be good to clarify that.

@hogo6002 hogo6002 changed the title feat(API): improve malicious package matching feat(API): update version matching for NuGet, PyPI and RubyGems Dec 10, 2024
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 this pull request may close these issues.

2 participants