feat: enable nuget in osv worker [CM-1276]#4270
Merged
Merged
Conversation
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
|
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds NuGet to the OSV advisories sync pipeline in packages_worker, ensuring the Temporal schedule accepts the OSV bucket’s canonical ecosystem casing and that downstream version comparisons treat NuGet as semver-based.
Changes:
- Added
NuGetto the OSV schedule allowlist (VALID_ECOSYSTEMS) soOSV_ECOSYSTEMSvalidation accepts it. - Updated local env defaults to include
NuGetinOSV_ECOSYSTEMS. - Refactored semver ecosystem detection into a shared
SEMVER_ECOSYSTEMSset and includednugetfor semver comparison.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| backend/.env.dist.local | Adds NuGet to the local default OSV_ECOSYSTEMS list. |
| services/apps/packages_worker/src/osv/schedule.ts | Extends the schedule allowlist to accept NuGet (case-sensitive OSV bucket path segment). |
| services/apps/packages_worker/src/osv/versionCompare.ts | Routes nuget through the semver comparator via SEMVER_ECOSYSTEMS. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
13
to
+14
| // Add new entries here when v1 expands beyond npm + Maven. | ||
| const VALID_ECOSYSTEMS = ['npm', 'Maven', 'cargo'] as const | ||
| const VALID_ECOSYSTEMS = ['npm', 'Maven', 'cargo', 'NuGet'] as const |
Comment on lines
+129
to
133
| const SEMVER_ECOSYSTEMS = new Set(['npm', 'cargo', 'nuget']) | ||
|
|
||
| // Ecosystem names are stored lowercase in packages-db per ADR-0001 §OSV | ||
| // "Ecosystem normalization" — 'npm', 'maven', 'cargo'. Callers (deriveCriticalFlag) | ||
| // pull the value straight from the DB so the literals here must match. |
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds support for the
NuGetecosystem to the OSV advisories sync process. The main changes include updating environment variables, validation lists, and version comparison logic to recognize and handleNuGetadvisories alongside existing ecosystems.NuGet ecosystem support:
NuGetto theOSV_ECOSYSTEMSenvironment variable inbackend/.env.dist.local, enabling the sync process to include NuGet advisories.VALID_ECOSYSTEMSarray inosv/schedule.tsto includeNuGet, ensuring that validation and scheduling logic recognize it as a supported ecosystem.Version comparison improvements:
SEMVER_ECOSYSTEMSset inosv/versionCompare.tsand updated thecompareVersionfunction to treatnugetas a semver-based ecosystem, ensuring correct version comparison logic for NuGet advisories.Note
Medium Risk
Extends vulnerability range matching for a new ecosystem; incorrect semver handling could mis-flag
has_critical_vulnerability, but the change follows the existing npm/cargo pattern with tests.Overview
NuGet is now included in the scheduled OSV bulk advisory sync alongside npm, Maven, and cargo.
Local env template
OSV_ECOSYSTEMSand the worker allowlist inschedule.tsgainNuGet(OSV’s case-sensitive bucket path).compareVersionroutes lowercasenugetthrough the same semver path as npm/cargo so introduced/fixed ranges can drive critical-vulnerability derivation. Tests cover semver ordering (including a Newtonsoft.Json CVE boundary) and reject titlecaseNuGetat the comparator, matching DB normalization.Reviewed by Cursor Bugbot for commit 4dcc816. Bugbot is set up for automated code reviews on this repo. Configure here.