Fix Go package PURL mapping by normalizing percent-encoding in plain …#553
Open
Gitjay11 wants to merge 1 commit into
Open
Fix Go package PURL mapping by normalizing percent-encoding in plain …#553Gitjay11 wants to merge 1 commit into
Gitjay11 wants to merge 1 commit into
Conversation
…PURL comparison Signed-off-by: Ajay Rajera <newajay.11r@gmail.com>
8660506 to
fc37c70
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issues
Changes
Go packages with
+incompatiblein their version string (e.g.pkg:golang/github.com/docker/docker@v19.03.15+incompatible) were failingto match against PurlDB entries. This caused the PurlDB tab to show as
disabled/empty even when "Improve Packages from PurlDB" worked correctly
for the same package.
There were two root causes:
1. Percent-encoding mismatch in PURL comparison
The old plain-PURL comparison used a naive
purl_str.split("?")[0]stringsplit. This meant
@v1.0.0+incompatibleand@v1.0.0%2Bincompatibleweretreated as different PURLs even though they represent the same version. The
fix introduces
get_plain_purl()indje/utils.pywhich normalises thePURL through
PackageURL.from_string()before comparison, so percent-encodedand literal forms are always considered equal.
plain_purls_equal()is athin helper that delegates to it.
2.
max_request_call=1cut off the PURL fallback on the PurlDB tabPackageTabPurlDBViewwas callingget_purldb_entries(max_request_call=1),meaning it stopped after the first lookup strategy (e.g.
download_url). Ifthat returned nothing (common for Go packages whose inferred proxy URL isn't
indexed in PurlDB), the tab showed no results — even though a subsequent PURL
lookup would have succeeded. "Improve Packages from PurlDB" worked because it
has no
max_request_calllimit. The fix removesmax_request_call=1from theview so all strategies (hash → download URL → PURL) are tried in sequence.
Checklist