Repository navigation
Conversation
jess-lowe
added a commit
that referenced
this pull request
Nov 13, 2026
…ranch pairing (#6347) Fixes #6320 ## Summary Fixes two Linux kernel CVE 5.0 conversion bugs in `vulnfeeds`: 1. **Separate mixed `git` and `semver` ranges within a single `Affected` block (#6320)**: - Linux CNA (`bippy`) records often include both `versionType: "git"` commit ranges and `versionType: "semver"` release intervals inside the same `defaultStatus: "unaffected"` `affected` block (e.g. `CVE-2026-99276`, `CVE-2026-100080`, `CVE-2023-52457`). - Previously, `LinuxVersionExtractor.handleAffected` inspected only `versionRangesWithMetadata[0].Range.GetType() == osvschema.Range_GIT` and coerced every extracted range in that block to `Range_GIT`, emitting release versions like `7.2.8` / `7.3` or `5.10.274` as `GIT` commit endpoints instead of `Linux` `Kernel` `ECOSYSTEM` ranges. - Partition extracted ranges individually (`Range_GIT && IsDirectGitRange` vs `Range_ECOSYSTEM`), and reconcile direct semver ranges from `defaultStatus: "unaffected"` blocks with inverse semver ranges from `defaultStatus: "affected"` blocks (`mergeLinuxEcosystemRanges`) so explicit backport intervals (e.g. `[7.2.8, 7.3)`, `[5.4.225, 5.4.268)`) are preserved and `0`-introduced direct semver ranges (e.g. `[0, 5.15.225)` in `CVE-2026-100080`) do not widen branch-scoped inverse intervals (`[5.11.0, 5.15.225)`). 2. **Fix `FindInverseAffectedRanges` branch-boundary pairing, duplicate branch fixes, bounded unaffected gaps, and 3/4-part versions**: - Previously, `FindInverseAffectedRanges` built separate `introduced` and `fixed` slices and zipped them by index (`for i := range fixed`). Whenever a CVE had both an explicit mainline `status: "affected"` entry (e.g. `6.1`) and backported `unaffected` stable branch entries on older branches (e.g. `5.4.*`, `5.10.*`, `5.15.*`), sorting `introduced` pushed `"6.1.0"` between `"5.16.0"` and `"6.2.0"`, shifting every subsequent `(introduced[i], fixed[i])` pair across branch boundaries (producing bogus cross-branch ranges like `[6.1.0, 6.6.14)`). - Pair each sorted unaffected branch entry directly with the preceding branch boundary (`nextIntroduced`), deduplicate multiple `unaffected` entries on the same wildcard branch by keeping the latest fix version (e.g. `CVE-2022-50396`), support bounded `lessThan` unaffected gaps between affected introductions (e.g. `CVE-2024-53204`), skip empty intervals (`introduced >= fixed`), and support multi-segment `2.6.x.*` wildcard prefixes / 4-part kernel versions. *(Companion ecosystem version matching support for #6319 is in #6345.)* ## Testing - Added unit tests in `vulnfeeds/conversion/cve5/version_extraction_test.go` covering mixed `git` + `semver` Linux CNA blocks (`CVE-2026-99276`, `CVE-2026-100080`, `CVE-2023-52457` shapes) and `FindInverseAffectedRanges` edge cases (mainline `affected` + earlier backport fixes, duplicate branch wildcards, bounded `lessThan` unaffected gaps, and `2.6.39.*` 3-part wildcards). - `cd vulnfeeds && go test ./...` - `poetry run tools/lint_and_format.sh` <!-- AI-PR -->
michaelkedar
approved these changes
Nov 18, 2026
michaelkedar
left a comment
Member
There was a problem hiding this comment.
Not sure if this logic might want to make its way into scalibr eventually
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6345 +/- ##
==========================================
+ Coverage 55.52% 55.82% +0.29%
==========================================
Files 222 223 +1
Lines 22926 22977 +51
==========================================
+ Hits 12730 12827 +97
+ Misses 10193 10147 -46
Partials 3 3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
Summary
Fixes #6319.
osvconstants.EcosystemLinux("Linux") had no helper registered ingo/osv/ecosystem, causing package/version queries forLinux/Kernel(e.g.,6.1.100) to fall back toversionIsMatchStringinbuildVersionMatcher. BecauseversionIsMatchStringonly inspectsAffectedVersions.Versionsand ignoresEvents, all CVELinux/Kerneladvisories—which publish per-stable-branchECOSYSTEMranges without enumeratedversions—returned zero matches while scanning everyLinux/KernelAffectedVersionsentity across paginated timeouts.Changes
go/osv/ecosystem/linux.go&go/osv/ecosystem/ecosystem.go: Implement and registerlinuxEcosystem(IsSemver() == false, non-Enumerable):6.1.100,v6.1.100,6.1==6.1.0, 4-part2.6.39.2>2.6.39, numeric-rcNpre-release orderingrc2 < rc10 < release, andv5.12-rc1-dontuse) while rejecting non-upstream/distro strings so unparseable inputs continue to fall back cleanly.Coarseversion bounds (00:XXXXXXXX.YYYYYYYY.ZZZZZZZZ) using the same parser for error parity. Existing un-reimported Datastore records (00:00000000.....99:99999999...) match immediately upon API deploy, and reimporting Linux sources will populate tight per-branch coarse bounds.go/osv/ecosystem/linux_test.go,coarse_fuzz_test.go,coarse_large_test.go, andwrapper_test.go(verified with 0 parse or monotonicity errors across all 4,115 unique version strings inLinux/all.zip).ComputeAffectedVersions/MatchPackagestests covering multi-branchCVE-2022-49034intervals (6.1.100matches,6.1.120/6.1.125do not), 4-part2.6.39.2boundaries, andv-prefixed legacy GSD kernel tags.Testing
cd go && go test ./osv/... ./internal/database/postgres/... ./internal/worker/... ./internal/website/... ./internal/osvutil/... ./internal/api/...passed.cd go && go test ./osv/ecosystem -fuzz=FuzzLinuxMonotonicity -fuzztime=8spassed.poetry run tools/lint_and_format.shpassed with 0 issues.