Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api): add enumeration version check #2452

Merged
merged 4 commits into from
Aug 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions gcp/api/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -1065,17 +1065,9 @@ def query_by_version(context: QueryContext,
# Query for non-enumerated ecosystems.
bugs, next_page_token = yield _query_by_comparing_versions(
context, query, ecosystem, version)
logging.info(
'[_query_by_comparing_versions] Package %s '
'at version %s has total %d bugs in %s', package_name or purl,
version, len(bugs), ecosystem)
else:
bugs, next_page_token = yield _query_by_generic_version(
context, query, package_name, ecosystem, purl, version)
logging.info(
'[_query_by_generic_version] Package %s '
'at version %s has total %d bugs in %s', package_name or purl,
version, len(bugs), ecosystem)

else:
logging.warning("Package query without ecosystem specified")
Expand Down Expand Up @@ -1267,7 +1259,11 @@ def _is_affected(ecosystem: str, version: str,
if affected:
return True

return False
# OSV allows users to add affected versions
# that are not covered by affected ranges.
# TODO(gongh@): Move this check before the version range check
# after performance analysis.
return version in affected_package.versions


def main():
Expand Down
Loading