Skip to content

fix(sbom): percent-encode vcs_url qualifier in generated purls#9670

Open
ubeddulla wants to merge 1 commit into
npm:latestfrom
ubeddulla:sbom-purl-vcs-url-encode
Open

fix(sbom): percent-encode vcs_url qualifier in generated purls#9670
ubeddulla wants to merge 1 commit into
npm:latestfrom
ubeddulla:sbom-purl-vcs-url-encode

Conversation

@ubeddulla

Copy link
Copy Markdown

Both SBOM generators build a git package's purl by sticking the raw node.resolved straight into the vcs_url qualifier, so any # or & in that resolved URL escapes the qualifier value. A git dep resolving to e.g. https://github.com/foo/bar.git?a=b&c=d#1234 produces pkg:npm/...?vcs_url=https://github.com/foo/bar.git?a=b&c=d#1234, where a purl parser reads c=d as a separate qualifier and 1234 as the subpath. Wrapping node.resolved in encodeURIComponent at both sites keeps it a single qualifier value; the existing git-url snapshots and two new assertions cover it.

@ubeddulla ubeddulla requested review from a team as code owners June 26, 2026 05:55
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.

1 participant