Skip to content

postgresql_importer_v2 marks only X.0.0 as affected, so 18.6 is not flagged for a CVE fixed in 18.7 #2559

Backlog

Description

@Ankit-dmc

What happens

postgresql_importer_v2 turns the "Affected" column of https://www.postgresql.org/support/security/ into an exact-version list. That column lists major branches (18, 17, 16, 15), so the stored range is

affected: vers:generic/15.0.0|16.0.0|17.0.0|18.0.0
fixed:    vers:generic/15.20.0|16.16.0|17.12.0|18.7.0

That says only 15.0.0, 16.0.0, 17.0.0 and 18.0.0 are affected. Every real vulnerable release (18.0–18.6, 17.0–17.11, ...) falls outside the range, so a lookup for pkg:generic/postgresql@18.6 does not report the CVE, even though 18.7 is the fix.

Reproduce

Using the live index page and the importer's own parser:

from vulnerabilities.pipelines.v2_importers.postgresql_importer import PostgreSQLImporterPipeline
from univers.versions import SemverVersion
import requests

url = "https://www.postgresql.org/support/security/"
ads = PostgreSQLImporterPipeline().to_advisories(requests.get(url).content, url)
pkg = ads[0].affected_packages[0]
print(ads[0].advisory_id, pkg.affected_version_range)
print(SemverVersion("18.6") in pkg.affected_version_range)   # False

All 118 rows on the page today are parsed this way. The test fixture encodes the same thing (parse-advisory-postgresql-expected.json: vers:generic/9.6.0|10.0.0|11.0.0|12.0.0).

Possible fix

Each fixed version already identifies its branch, so the affected range can be built per branch: for a fixed version 18.7 the branch is 18 (9.6 for pre-10 versions), giving >=18.0|<18.7. For the row above:

vers:generic/>=15.0|<15.20|>=16.0|<16.16|>=17.0|<17.12|>=18.0|<18.7

A branch listed as affected with no fixed version (unsupported branches) could stay >=X.0 with no upper bound, or be left out. Happy to open a PR if this approach sounds right.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions