Skip to content

Do not build an empty version range in the apache_httpd importer#2392

Open
Sanjays2402 wants to merge 1 commit into
aboutcode-org:mainfrom
Sanjays2402:fix/empty-version-range-apache-httpd
Open

Do not build an empty version range in the apache_httpd importer#2392
Sanjays2402 wants to merge 1 commit into
aboutcode-org:mainfrom
Sanjays2402:fix/empty-version-range-apache-httpd

Conversation

@Sanjays2402

Copy link
Copy Markdown

Closes #2387

ApacheHTTPDImporterPipeline.to_version_ranges() always returned ApacheVersionRange(constraints=constraints). When every candidate version is empty or ignorable the constraint list is empty and the range serializes to vers:apache/, which VersionRange.from_string() later rejects with "specifies no version range constraints" — so AffectedPackage.from_dict logs the reported traceback and drops the package. Returning None instead lets the existing if affected_version_range: guard in to_advisory() skip it cleanly.

Regression test test_to_version_ranges_without_constraints fails on the unpatched code and passes with the fix.

to_version_ranges() returned ApacheVersionRange(constraints=constraints)
unconditionally. When every candidate version is empty or ignorable the
constraint list is empty and the range serializes to "vers:apache/", which
VersionRange.from_string() later rejects with "specifies no version range
constraints", so the whole AffectedPackage is dropped with a traceback.

Return None instead when there are no constraints; the caller already skips
building an AffectedPackage for a falsy range.

Adds a regression test asserting the constraint-less case yields no range.
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.

Invalid version range in apache_httpd and gentoo advisory

1 participant