- Affects: pncli v1.18.0 (main @ ff6e924,
checkmarx project list, checkmarx scan list)
- Symptom: Against a Checkmarx One tenant with zero projects (or zero scans), both commands fail with
Cannot read properties of null (reading 'length') instead of returning an empty list. The CxOne API returns {"totalCount":0,"filteredTotalCount":0,"projects":null} (projects/scans is null, not [], when there are no results), but CheckmarxClient.listProjects()/listScans() in src/services/checkmarx/client.ts unconditionally read res.projects.length / res.scans.length to build the "only showing first N" warning, which throws on null.
- Repro: Against an empty-but-authenticated CxOne tenant:
pncli checkmarx project list → {"ok":false,"error":{"status":1,"message":"Cannot read properties of null (reading 'length')"}}. Same for pncli checkmarx scan list.
- Expected: Returns
{"ok":true,"data":[]} (or similar) when the tenant has no projects/scans, matching the behavior of every other list command in pncli when a result set is empty.
- Notes:
checkmarx project get, scan get, and scan stats handle missing/invalid IDs fine (clean 404/403 JSON errors), so the bug is isolated to the two list methods' truthiness/length check on a null array. Fix: guard with (res.projects ?? []).length (and use res.projects ?? [] as the returned value) — same for scans. test-checkmarx.ps1 marks these two assertions -Optional (documenting the current failure) until this is fixed upstream.
Service: Checkmarx
Submitted via kolatts.github.io/pncli
checkmarx project list,checkmarx scan list)Cannot read properties of null (reading 'length')instead of returning an empty list. The CxOne API returns{"totalCount":0,"filteredTotalCount":0,"projects":null}(projects/scansisnull, not[], when there are no results), butCheckmarxClient.listProjects()/listScans()insrc/services/checkmarx/client.tsunconditionally readres.projects.length/res.scans.lengthto build the "only showing first N" warning, which throws onnull.pncli checkmarx project list→{"ok":false,"error":{"status":1,"message":"Cannot read properties of null (reading 'length')"}}. Same forpncli checkmarx scan list.{"ok":true,"data":[]}(or similar) when the tenant has no projects/scans, matching the behavior of every other list command in pncli when a result set is empty.checkmarx project get,scan get, andscan statshandle missing/invalid IDs fine (clean404/403JSON errors), so the bug is isolated to the twolistmethods' truthiness/length check on anullarray. Fix: guard with(res.projects ?? []).length(and useres.projects ?? []as the returned value) — same forscans.test-checkmarx.ps1marks these two assertions-Optional(documenting the current failure) until this is fixed upstream.Service: Checkmarx
Submitted via kolatts.github.io/pncli