Skip to content

vulnfeeds: Add some more common phrases when extracting versions from CVE description #249

Open

Description

@westonsteimel

Current logic is here

Here are a few I've seen from examining some of my recent manual triages:

  • x.x.x up to and including x.x.x
  • x.x.x and earlier
  • x.x.x or older
  • x.x.x and below
  • up to and including x.x.x
  • prior to x.x.x
  • below x.x.x

Activity

  1. added
    vulnfeeds
    actionability tbd
    on Oct 18, 2022
  2. removed
    actionability tbd
    on Nov 1, 2022
  3. github-actions commented on Jul 30, 2024

    @github-actions

    This issue has not had any activity for 60 days and will be automatically closed in two weeks

  4. added
    stale
    on Jul 30, 2024
  5. added
    enhancement
    on Aug 5, 2024
  6. andrewpollock commented on Aug 5, 2024

    @andrewpollock
    Contributor

    func extractVersionsFromDescription(validVersions []string, description string) ([]AffectedVersion, []string) {
    // Match:
    // - x.x.x before x.x.x
    // - x.x.x through x.x.x
    // - through x.x.x
    // - before x.x.x
    pattern := regexp.MustCompile(`(?i)([\w.+\-]+)?\s+(through|before)\s+(?:version\s+)?([\w.+\-]+)`)
    matches := pattern.FindAllStringSubmatch(description, -1)
    if matches == nil {
    return nil, []string{"Failed to parse versions from description"}
    }
    var notes []string
    var versions []AffectedVersion
    for _, match := range matches {
    // Trim periods that are part of sentences.
    introduced := processExtractedVersion(match[1])
    fixed := processExtractedVersion(match[3])
    lastaffected := ""
    if match[2] == "through" {
    // "Through" implies inclusive range, so the fixed version is the one that comes after.
    var err error
    fixed, err = nextVersion(validVersions, fixed)
    if err != nil {
    notes = append(notes, err.Error())
    // if that inference failed, we know this version was definitely still vulnerable.
    lastaffected = cleanVersion(match[3])
    notes = append(notes, fmt.Sprintf("Using %s as last_affected version instead", cleanVersion(match[3])))
    }
    }
    if introduced == "" && fixed == "" && lastaffected == "" {
    notes = append(notes, "Failed to match version range from description")
    continue
    }
    if introduced != "" && !hasVersion(validVersions, introduced) {
    notes = append(notes, fmt.Sprintf("Extracted introduced version %s is not a valid version", introduced))
    }
    if fixed != "" && !hasVersion(validVersions, fixed) {
    notes = append(notes, fmt.Sprintf("Extracted fixed version %s is not a valid version", fixed))
    }
    if lastaffected != "" && !hasVersion(validVersions, lastaffected) {
    notes = append(notes, fmt.Sprintf("Extracted last_affected version %s is not a valid version", lastaffected))
    }
    // Favour fixed over last_affected for schema compliance.
    if fixed != "" && lastaffected != "" {
    lastaffected = ""
    }
    versions = append(versions, AffectedVersion{
    Introduced: introduced,
    Fixed: fixed,
    LastAffected: lastaffected,
    })
    }
    return versions, notes
    }

  7. andrewpollock commented on Aug 5, 2024

    @andrewpollock
    Contributor

    This regex might do the trick:

    (?i)([\w.+\-]+)?\s+(through|before|up to and including|prior to|below|(?:(?:and|or)\s+(?:earlier|older|below)))\s+(?:version\s+)?([\w.+\-]+)

  8. removed
    stale
    on Aug 6, 2024
  9. github-actions commented on Oct 5, 2024

    @github-actions

    This issue has not had any activity for 60 days and will be automatically closed in two weeks

    See https://github.com/google/osv.dev/blob/master/CONTRIBUTING.md for how to contribute a PR if you're interested in helping out.

  10. added
    stale
    on Oct 5, 2024
  11. removed
    stale
    on Nov 7, 2024
  12. removed their assignment
    on Apr 2, 2025
  13. self-assigned this
    on Feb 24, 2026
  14. ashutos-h-tiwari commented on Jul 31, 2026

    @ashutos-h-tiwari

    Hi maintainers, I'd like to work on this issue as my first contribution. Could you please assign it to me?

  15. aeagisenginesec commented on Dec 5, 2026

    @aeagisenginesec

    Hi @ashutos-h-tiwari and maintainers,

    I would like to work on this issue if it is still free. I see it was assigned on Jul 31, 2026, but there has been no PR or activity since, so I wanted to check first before starting.

    I also read the previous PR #4550 and the review feedback. My plan is to pick that work up cleanly on top of the current code:

    • Extend extractVersionsFromDescription in vulnfeeds/cves/versions.go to cover the phrases listed here, including "up to and including", "and earlier", "or older", "prior to", and "below"
    • Build on the candidate regex andrewpollock suggested
    • Add table-driven tests in versions_test.go with real-world CVE description examples

    A bit about me: I build Aegis, a Go scanner for IaC and vulnerability detection, so version parsing from CVE descriptions is directly in my day-to-day work.

    If @ashutos-h-tiwari is no longer working on this, could you please reassign it to me? Happy to start once you confirm.

    Thanks,
    Reda

  16. ashutos-h-tiwari commented on Dec 5, 2026

    @ashutos-h-tiwari

    Hi @aeagisenginesec and maintainers — thanks for checking in! Sorry for the delay on this; I was tied up with my university exams, which just wrapped up.
    I'd still like to keep this issue and finish it up. I'm picking up the work on extractVersionsFromDescription in vulnfeeds/cves/versions.go and the table-driven tests in versions_test.go now, and I will open a PR by Thursday, December 10.

  17. aeagisenginesec commented on Dec 5, 2026

    @aeagisenginesec

    Hi @ashutos-h-tiwari, thanks for picking this back up, happy to leave it with you if the maintainers prefer that. Just noting my PR #6512 is already open, built on current main, in vulnfeeds/conversion/versions.go (the code moved from vulnfeeds/cves/versions.go), adding below and or-older / or-earlier / or-below, with tests passing. Happy for the maintainers to pick either one, or for you to build on mine if useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementgood first issuevulnfeeds

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions