Repository navigation
Fix CxOne.ScaAPI silently dropping url_prefix, unskip 23 tests - #240
Merged
Merged
Conversation
cx-happy-yang
force-pushed
the
fix/sca-api-url-prefix-dead-code
branch
from
November 11, 2026 05:17
f02776d to
a72efad
Compare
|
Great job! No new security vulnerabilities introduced in this pull request |
cx-nathan-leach
previously approved these changes
Nov 11, 2026
Sca.__init__ built self.base_url straight from configuration.server_base_url, never applying api_client.url_prefix. That combining logic (server_base_url + url_prefix + relative_url) lived in ApiClient.create_url, removed in 63bc292 ([refactor] eliminate is_iam, relative_url, and create_url, May 2026) when Sca switched to building absolute f-string URLs itself; url_prefix was left on ApiClient but nothing has read it since. CxOne/scaAPI.py passes url_prefix="/api/sca" specifically so CxOne's gateway can route SCA calls correctly -- it's been silently ineffective since that refactor, so every CxOne SCA call (including gql_url) hit https://<tenant>/... instead of https://<tenant>/api/sca/.... Fixed by folding api_client.url_prefix into Sca.base_url. CxScaApiSDK's own direct usage is unaffected (it never passes url_prefix). Live-verified: get_all_projects() via CxOne.ScaAPI failed with '400 Request Header Or Cookie Too Large' (misrouted by the tenant gateway) before the fix, returned 18 real projects after. tests/CxOne/test_sca_api.py's entire 24-test suite was skip-marked with the misdiagnosed reason '400 Request Header Too Large - SCA API nginx header buffer limitation' -- that 400 was this bug. Removed the skip markers: 23 pass live now. The 24th (test_get_one_vulnerability) surfaced a separate, pre-existing bug -- its GraphQL query requests a vulnerabilityFixResolutionText field the live schema rejects -- left unfixed (out of scope here) with an accurate skip reason instead.
cx-happy-yang
force-pushed
the
fix/sca-api-url-prefix-dead-code
branch
from
November 12, 2026 01:58
a72efad to
365588b
Compare
Contributor
Author
|
Hi @cx-james-bostock . I just resolved a merge conflict for this PR. Could you please help me approve? |
cx-james-bostock
approved these changes
Nov 12, 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.

Sca.init built self.base_url straight from
configuration.server_base_url, never applying api_client.url_prefix. That combining logic (server_base_url + url_prefix + relative_url) lived in ApiClient.create_url, removed in 63bc292 ([refactor] eliminate is_iam, relative_url, and create_url, May 2026) when Sca switched to building absolute f-string URLs itself; url_prefix was left on ApiClient but nothing has read it since.
CxOne/scaAPI.py passes url_prefix="/api/sca" specifically so CxOne's gateway can route SCA calls correctly -- it's been silently ineffective since that refactor, so every CxOne SCA call (including gql_url) hit https:///... instead of https:///api/sca/.... Fixed by folding api_client.url_prefix into Sca.base_url. CxScaApiSDK's own direct usage is unaffected (it never passes url_prefix).
Live-verified: get_all_projects() via CxOne.ScaAPI failed with '400 Request Header Or Cookie Too Large' (misrouted by the tenant gateway) before the fix, returned 18 real projects after.
tests/CxOne/test_sca_api.py's entire 24-test suite was skip-marked with the misdiagnosed reason '400 Request Header Too Large - SCA API nginx header buffer limitation' -- that 400 was this bug. Removed the skip markers: 23 pass live now. The 24th (test_get_one_vulnerability) surfaced a separate, pre-existing bug -- its GraphQL query requests a vulnerabilityFixResolutionText field the live schema rejects -- left unfixed (out of scope here) with an accurate skip reason instead.