Fix 404 on AI Triage results by URL-encoding group_id - #224
Merged
Conversation
retrieve_ai_triage_results() built the request path as
"{base_url}/triage/{project_id}/{group_id}" without encoding group_id.
SCA group ids can contain reserved URL characters, e.g.
"CVE-2015-4852#-#Maven-commons-collections:commons-collections-3.2.1#-#<uuid>",
and '#' starts a URL fragment, so the server received a truncated path
and returned 404.
group_id is now percent-encoded with urllib.parse.quote before being
substituted into the path, so callers pass the raw value instead of
having to pre-encode it themselves. Updated the existing integration
tests (which previously pre-encoded group_id, which would now double-
encode it) and added unit tests covering the encoding behavior.
|
Great job! No new security vulnerabilities introduced in this pull request |
Covers the SAST case reported with a negative similarity_id (e.g. -501015144): '-' is an unreserved URL character, so quote() must leave it unchanged rather than encoding it. Verified end-to-end against a live tenant: - SCA case from the original report (CVE-...#-#...#-#...): 200 OK, was 404 - SAST positive similarity_id (existing integration test): PASSED - SAST negative similarity_id (-501015144): 200 OK, unchanged
cx-james-bostock
approved these changes
Sep 2, 2026
cx-james-bostock
left a comment
Contributor
There was a problem hiding this comment.
Hi @cx-happy-yang,
Looks good to me.
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.

retrieve_ai_triage_results() built the request path as "{base_url}/triage/{project_id}/{group_id}" without encoding group_id. SCA group ids can contain reserved URL characters, e.g. "CVE-2015-4852#-#Maven-commons-collections:commons-collections-3.2.1#-#", and '#' starts a URL fragment, so the server received a truncated path and returned 404.
group_id is now percent-encoded with urllib.parse.quote before being substituted into the path, so callers pass the raw value instead of having to pre-encode it themselves. Updated the existing integration tests (which previously pre-encoded group_id, which would now double- encode it) and added unit tests covering the encoding behavior.