fix: drop leading /api/ from CheckmarxClient paths (fixes doubled /api/api/ after buildUrl fix) - #287
Conversation
…ment after buildUrl() fix CheckmarxClient used absolute paths like /api/projects while checkmarx.baseUrl already ends with /api (e.g. https://tenant.cxone.cloud/api). After PR #284 correctly fixed buildUrl() to preserve base path segments, the combination produced /api/api/projects. Fix paths to be relative (projects, scans, results/summary) so they resolve correctly against the /api base — mirrors the same fix applied to Artifactory in BUG-4. Closes #285 Co-authored-by: Sunny Kolattukudy <kolatts@users.noreply.github.com>
|
Claude finished @kolatts's task in 4m 5s —— View job PR Review Complete
SummaryThe path changes in However, Blocking
What looks good
|
|
|
||
| async listProjects(): Promise<CxOneProject[]> { | ||
| const res = await this.http.checkmarx<CxOneProjectsResponse>('/api/projects', { params: { limit: 100 } }); | ||
| const res = await this.http.checkmarx<CxOneProjectsResponse>('projects', { params: { limit: 100 } }); |
There was a problem hiding this comment.
These paths now implicitly require that checkmarx.baseUrl ends with /api (e.g. https://ast.checkmarx.net/api), but skills/pncli/checkmarx.md still documents the example as https://ast.checkmarx.net (no /api).
With buildUrl('https://ast.checkmarx.net', 'projects') the result is https://ast.checkmarx.net/projects — the /api/ segment is missing, so any user who followed the documented example before this PR will silently get 404s.
CLAUDE.md calls the skills file the "onboarding contract" and says it must be updated on every credential/URL change. The fix needs to either:
a) Update the docs — change the example in skills/pncli/checkmarx.md from https://ast.checkmarx.net → https://ast.checkmarx.net/api
| const res = await this.http.checkmarx<CxOneProjectsResponse>('projects', { params: { limit: 100 } }); | |
| const res = await this.http.checkmarx<CxOneProjectsResponse>('projects', { params: { limit: 100 } }); |
(No code change needed here — the paths are correct given option a. Just noting the inline location of the dependency.)
b) Keep /api/ in the paths as a relative prefix (e.g. api/projects) and keep the documented base URL as https://ast.checkmarx.net. But this still breaks users who already have /api in their saved config, so option (a) is cleaner.
Either way, skills/pncli/checkmarx.md must be updated before merging.
There was a problem hiding this comment.
BLOCKING — documentation not updated to match the new base URL contract.
Summary
The path changes in CheckmarxClient are logically correct: dropping the leading /api/ removes the doubling that PR #284's buildUrl() fix introduced for users whose base URL already contained /api. The test updates match the new paths.
However, skills/pncli/checkmarx.md was not updated, and CLAUDE.md is explicit that this file is the onboarding contract and must be kept in sync on every credential or URL change.
Blocking issue
buildUrl('https://ast.checkmarx.net', 'projects') resolves to https://ast.checkmarx.net/projects — the /api/ segment is gone. Any user who followed the documented example (baseUrl = https://ast.checkmarx.net) before this PR will silently get 404s after upgrading.
skills/pncli/checkmarx.md needs to update its example from https://ast.checkmarx.net to https://ast.checkmarx.net/api so the documented base URL matches what buildUrl() now expects. See inline comment on client.ts:14.
What looks good
- The 5-path edit in
client.tsis consistent and the logic is correct given the contract change. - Both unit-test assertions in
client.test.tswere updated to match the new paths. buildCheckmarxFetcherderives the IAM host fromnew URL(baseUrl).hostnameonly, so adding/apito the base URL path does not affect token exchange.
|
@claude[agent] Update accordingly based on PR feedback, note that there are no users that were using checkmarx before so breaking changes are ok. |
|
Claude finished @kolatts's task in 1m 47s —— View job
Review CompleteThe blocking issue from the previous review has been addressed. Both commits in this PR are correct.
All 5 paths in No issues found. |
There was a problem hiding this comment.
Approved
The blocking issue from the previous review has been addressed. Both commits in this PR are correct.
docs: update Checkmarx API base URL — skills/pncli/checkmarx.md now documents the base URL as https://ast.checkmarx.net/api throughout (table, config file, env var, and regional deployment note). Onboarding contract is in sync.
fix: drop leading /api/ from CheckmarxClient paths — All 5 paths in client.ts are bare relative paths (projects, projects/${id}, scans, scans/${id}, results/summary). buildUrl('https://ast.checkmarx.net/api', 'projects') correctly resolves to https://ast.checkmarx.net/api/projects. buildCheckmarxFetcher uses new URL(baseUrl).hostname for IAM host derivation so the /api path segment doesn't affect token exchange. Both unit test assertions updated to match.
No issues found.
Fixes the
/api/api/path doubling regression introduced by PR #284.Closes #285
Generated with Claude Code