Skip to content

Commit c99d652

Browse files
committed
osv: skip ECOSYSTEM ranges for Go and npm
The GitHub Advisory Database published advisories for the npm package nocodb using ECOSYSTEM range type instead of SEMVER (e.g., GHSA-4w6r-5c2j-qf5f). This happens because nocodb switched to calendar-based versioning (2026.04.1), which is not valid SemVer 2.0 — the advisory database chose ECOSYSTEM accordingly. The parser currently returns a hard error for ECOSYSTEM ranges on Go and npm ecosystems, added as a defensive check in a607a05 and 87be024. This error propagates through Parse, aborting the entire ecosystem update. This change skips the range with a warning instead, using the same pattern as GIT ranges. The advisory is recorded via stats.Ignored. Signed-off-by: J. Victor Martins <jvdm@sdf.org>
1 parent c450218 commit c99d652

2 files changed

Lines changed: 66 additions & 2 deletions

File tree

updater/osv/osv.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,16 @@ func (e *ecs) Insert(ctx context.Context, log *slog.Logger, skipped *stats, name
641641
switch r.Type {
642642
case `SEMVER`:
643643
case `ECOSYSTEM`:
644+
switch af.Package.Ecosystem {
645+
case ecosystemGo, ecosystemNPM:
646+
log.WarnContext(ctx, "unexpected ECOSYSTEM range, skipping",
647+
"ecosystem", af.Package.Ecosystem,
648+
"advisory", a.ID)
649+
if skipped != nil {
650+
skipped.Ignored(a.ID)
651+
}
652+
continue
653+
}
644654
b.Reset()
645655
case `GIT`:
646656
// ignore, not going to fetch source.
@@ -730,8 +740,6 @@ func (e *ecs) Insert(ctx context.Context, log *slog.Logger, skipped *stats, name
730740
case ev.LastAffected != "":
731741
vs.ecosystemRange.Add("lastAffected", ev.LastAffected)
732742
}
733-
case ecosystemGo, ecosystemNPM:
734-
return fmt.Errorf(`unexpected "ECOSYSTEM" entry for %q ecosystem: %s`, af.Package.Ecosystem, a.ID)
735743
default:
736744
switch {
737745
case ev.Introduced == "0": // -Inf

updater/osv/osv_test.go

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,62 @@ var insertTestCases = []struct {
632632
},
633633
},
634634
},
635+
{
636+
name: "npm_ecosystem_range_skipped",
637+
ad: &advisory{
638+
ID: "GHSA-test-npm-1",
639+
Affected: []affected{
640+
{
641+
Package: _package{
642+
Ecosystem: "npm",
643+
Name: "nocodb",
644+
},
645+
Ranges: []_range{
646+
{
647+
Type: "ECOSYSTEM",
648+
Events: []rangeEvent{
649+
{
650+
Introduced: "0",
651+
},
652+
{
653+
Fixed: "2026.04.1",
654+
},
655+
},
656+
},
657+
},
658+
},
659+
},
660+
},
661+
expectedVulns: nil,
662+
},
663+
{
664+
name: "go_ecosystem_range_skipped",
665+
ad: &advisory{
666+
ID: "GHSA-test-go-1",
667+
Affected: []affected{
668+
{
669+
Package: _package{
670+
Ecosystem: "Go",
671+
Name: "example.com/module",
672+
},
673+
Ranges: []_range{
674+
{
675+
Type: "ECOSYSTEM",
676+
Events: []rangeEvent{
677+
{
678+
Introduced: "0",
679+
},
680+
{
681+
Fixed: "1.2.3",
682+
},
683+
},
684+
},
685+
},
686+
},
687+
},
688+
},
689+
expectedVulns: nil,
690+
},
635691
}
636692

637693
// cmpIgnore will ignore everything expect the Name, Updater, Range and FixedInVersion.

0 commit comments

Comments
 (0)