Skip to content

refactor(vulnfeeds): utilise a strategy pattern on a CNA basis to reduce carveout logic - #5971

Open
jess-lowe wants to merge 6 commits into
google:masterfrom
jess-lowe:refactor/strategies
Open

refactor(vulnfeeds): utilise a strategy pattern on a CNA basis to reduce carveout logic#5971
jess-lowe wants to merge 6 commits into
google:masterfrom
jess-lowe:refactor/strategies

Conversation

@jess-lowe

Copy link
Copy Markdown
Contributor

Refactors CVE5 version extraction from nested fallback branches into a modular, priority-based strategy pipeline. This will be so much easier to extend as we get better insights on CNA quirks.

Highlights

  • Strategy Pipeline: Introduced VersionStrategy with configurable priority levels (PriorityFirst, PriorityStandard, PriorityLastResort) and CNA-specific presets (Default, GitHub, MITRE, Linux).
  • Extracted Strategies: Isolated parsing for standard bounds, split/unspecified ranges, changes blocks, string range expressions, git commit hashes, CPE applicability, and single-version heuristics.
  • Direct Git Ranges: Bypass tag-to-commit normalization when ranges already contain commit SHAs via IsDirectGitRange.
  • Early Exit: If repos are unavailable, cleanly record unresolved ranges to database_specific.unresolved_ranges without running redundant fallbacks.
  • Tests: Added comprehensive unit tests for each strategy, priority ordering, and split/git ranges.

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.

1 participant