Skip to content

Fix CxOne.ScaAPI silently dropping url_prefix, unskip 23 tests - #240

Merged
cx-happy-yang merged 1 commit into
masterfrom
fix/sca-api-url-prefix-dead-code
Nov 12, 2026
Merged

cx-happy-yang merged 1 commit into
masterfrom
fix/sca-api-url-prefix-dead-code

Conversation

@cx-happy-yang

Copy link
Copy Markdown
Contributor

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.

@cx-happy-yang
cx-happy-yang requested a review from a team November 11, 2026 05:14
@cx-happy-yang cx-happy-yang added the workflows-approved A PR needs the label workflows-approved to run any workflows. label Nov 11, 2026
@cx-happy-yang cx-happy-yang self-assigned this Nov 11, 2026
@cx-happy-yang
cx-happy-yang force-pushed the fix/sca-api-url-prefix-dead-code branch from f02776d to a72efad Compare November 11, 2026 05:17
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Logo
Checkmarx One – Scan Summary & Details – 7e28eccd-289e-4573-8e67-23b12776bbb5

Great job! No new security vulnerabilities introduced in this pull request

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

Copy link
Copy Markdown
Contributor Author

Hi @cx-james-bostock .

I just resolved a merge conflict for this PR. Could you please help me approve?

@cx-james-bostock cx-james-bostock left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @cx-happy-yang,
Looks good to me.

@cx-happy-yang
cx-happy-yang merged commit 8fb9f5e into master Nov 12, 2026
9 checks passed
@cx-happy-yang
cx-happy-yang deleted the fix/sca-api-url-prefix-dead-code branch November 12, 2026 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

workflows-approved A PR needs the label workflows-approved to run any workflows.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants