Skip to content

fix(api): allow Alpine queries without a release number - #2946

Merged
hogo6002 merged 1 commit into
google:masterfrom
hogo6002:fix_alpine_purl_query
Dec 3, 2024
Merged

hogo6002 merged 1 commit into
google:masterfrom
hogo6002:fix_alpine_purl_query

Conversation

@hogo6002

@hogo6002 hogo6002 commented Dec 3, 2024

Copy link
Copy Markdown
Contributor

The OSV spec requires Alpine packages to have a :v<RELEASE-NUMBER> suffix. Currently, our API has inconsistencies regarding Alpine queries:

  • It returns a 400 status code with the error message "Invalid ecosystem" for all Alpine package/ecosystem queries without a release number.
  • However, for Alpine PURL queries (e.g.
    pkg:apk/alpine/postgresql14?arch=source), it returns all matching vulnerabilities across all releases.

Also we recently switched our PURL query from PURL string matching to package/ecosystem matching (#2900). This change causes all Alpine-related PURL API queries to fail because PURL string doesn't contain any release info and the PURL spec doesn't define how to include release numbers.

Since OSV-generated Alpine PURLs (e.g.
pkg:apk/alpine/postgresql14?arch=source) don't contain release numbers, we should allow Alpine queries without a release number for consistency. This change would return all matching vulnerabilities across different releases when no release number is specified.

@andrewpollock

Copy link
Copy Markdown
Contributor

This change aside, I think there's a important need to up-level the API documentation, none of the nuances around expectations and behaviour of purl parameters are really discussed in any sort of detail.

@hogo6002
hogo6002 merged commit 91a0125 into google:master Dec 3, 2024
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.

3 participants