From 5d9a4c3d5c22b9093d4578326a18826d449c92b2 Mon Sep 17 00:00:00 2001 From: cx-ben-alvo <144705560+cx-ben-alvo@users.noreply.github.com> Date: Sun, 14 Sep 2025 11:47:19 +0300 Subject: [PATCH 1/4] Add new telemetry fields to telemetryAIEvent method (AST-113145) --- src/main/wrapper/CxConstants.ts | 5 ++++- src/main/wrapper/CxWrapper.ts | 7 +++++-- src/tests/TelemetryTest.test.ts | 33 ++++++++++++++++++++++++++++----- 3 files changed, 37 insertions(+), 8 deletions(-) diff --git a/src/main/wrapper/CxConstants.ts b/src/main/wrapper/CxConstants.ts index d8214caa..7c40bc12 100644 --- a/src/main/wrapper/CxConstants.ts +++ b/src/main/wrapper/CxConstants.ts @@ -122,5 +122,8 @@ export enum CxConstants { AI_PROVIDER = "--ai-provider", TYPE = "--type", SUB_TYPE = "--sub-type", - PROBLEM_SEVERITY = "--problem-severity" + PROBLEM_SEVERITY = "--problem-severity", + SCAN_TYPE_FLAG = "--scan-type", + STATUS = "--status", + TOTAL_COUNT = "--total-count", } diff --git a/src/main/wrapper/CxWrapper.ts b/src/main/wrapper/CxWrapper.ts index 32fa485f..67ded66c 100644 --- a/src/main/wrapper/CxWrapper.ts +++ b/src/main/wrapper/CxWrapper.ts @@ -530,7 +530,7 @@ export class CxWrapper { return new ExecutionService().executeCommands(this.config.pathToExecutable, commands, CxConstants.MASK_TYPE); } - telemetryAIEvent(aiProvider: string, agent: string, eventType: string, subType: string, engine: string, problemSeverity: string): Promise { + telemetryAIEvent(aiProvider: string, agent: string, eventType: string, subType: string, engine: string, problemSeverity: string, scanType: string, status: string, totalCount: number): Promise { const commands: string[] = [ CxConstants.TELEMETRY, CxConstants.SUB_CMD_TELEMETRY_AI, @@ -539,7 +539,10 @@ export class CxWrapper { CxConstants.TYPE, eventType, CxConstants.SUB_TYPE, subType, CxConstants.ENGINE, engine, - CxConstants.PROBLEM_SEVERITY, problemSeverity + CxConstants.PROBLEM_SEVERITY, problemSeverity, + CxConstants.SCAN_TYPE_FLAG, scanType, + CxConstants.STATUS, status, + CxConstants.TOTAL_COUNT, totalCount.toString() ]; commands.push(...this.initializeCommands(false)); const exec = new ExecutionService(); diff --git a/src/tests/TelemetryTest.test.ts b/src/tests/TelemetryTest.test.ts index 74cdc933..df100008 100644 --- a/src/tests/TelemetryTest.test.ts +++ b/src/tests/TelemetryTest.test.ts @@ -5,7 +5,7 @@ import { BaseTest } from "./BaseTest"; describe("Telemetry cases", () => { const cxScanConfig = new BaseTest(); - it.skip('TelemetryAIEvent Successful case with minimal parameters', async () => { + it('TelemetryAIEvent Successful case with minimal parameters - ai log', async () => { const wrapper = new CxWrapper(cxScanConfig); const cxCommandOutput: CxCommandOutput = await wrapper.telemetryAIEvent( "Cursor", @@ -13,14 +13,34 @@ describe("Telemetry cases", () => { "click", "ast-results.viewPackageDetails", "secrets", - "high" + "high", + "", + "", + 0 + ); + console.log("Json object from telemetryAIEvent successful case: " + JSON.stringify(cxCommandOutput)); + expect(cxCommandOutput.exitCode).toBe(0); + }); + + it('TelemetryAIEvent Successful case with minimal parameters - detection log', async () => { + const wrapper = new CxWrapper(cxScanConfig); + const cxCommandOutput: CxCommandOutput = await wrapper.telemetryAIEvent( + "", + "", + "", + "", + "", + "", + "asca", + "Critical", + 10 ); console.log("Json object from telemetryAIEvent successful case: " + JSON.stringify(cxCommandOutput)); expect(cxCommandOutput.exitCode).toBe(0); }); - it.skip('TelemetryAIEvent Successful case with edge case parameters', async () => { + it('TelemetryAIEvent Successful case with edge case parameters', async () => { const wrapper = new CxWrapper(cxScanConfig); const cxCommandOutput: CxCommandOutput = await wrapper.telemetryAIEvent( "", @@ -28,9 +48,12 @@ describe("Telemetry cases", () => { "", "", "", - "" + "", + "", + "", + 0 ); console.log("Json object from telemetryAIEvent with empty parameters: " + JSON.stringify(cxCommandOutput)); - expect(typeof cxCommandOutput.exitCode).toBe(0); + expect(cxCommandOutput.exitCode).toBe(0); }); }); \ No newline at end of file From e2d0b9c5b1577957cad6857d0105011dced694af Mon Sep 17 00:00:00 2001 From: cx-ben-alvo <144705560+cx-ben-alvo@users.noreply.github.com> Date: Mon, 15 Sep 2025 13:51:42 +0300 Subject: [PATCH 2/4] Update token in update-cli.yml to use GITHUB_TOKEN --- .github/workflows/update-cli.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-cli.yml b/.github/workflows/update-cli.yml index 5c287328..5501c04b 100644 --- a/.github/workflows/update-cli.yml +++ b/.github/workflows/update-cli.yml @@ -59,7 +59,7 @@ jobs: if: steps.checkmarx-ast-cli.outputs.current_tag != steps.checkmarx-ast-cli.outputs.release_tag uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c #v6 with: - token: ${{ secrets.AUTOMATION_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} commit-message: Update checkmarx-ast-cli to ${{ steps.checkmarx-ast-cli.outputs.release_tag }} title: Update checkmarx-ast-cli binaries with ${{ steps.checkmarx-ast-cli.outputs.release_tag }} body: | From ae1f83d927cc56f255b12abf6dba1d3014276f35 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 15 Sep 2025 13:52:56 +0300 Subject: [PATCH 3/4] Update checkmarx-ast-cli binaries with 2.3.35 (#899) * Track Checkmarx CLI binaries with Git LFS * Update checkmarx-ast-cli to 2.3.35 --------- Co-authored-by: github-actions Co-authored-by: cx-ben-alvo <144705560+cx-ben-alvo@users.noreply.github.com> --- checkmarx-ast-cli.version | 2 +- src/main/wrapper/resources/cx-linux | 4 ++-- src/main/wrapper/resources/cx-mac | 4 ++-- src/main/wrapper/resources/cx.exe | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/checkmarx-ast-cli.version b/checkmarx-ast-cli.version index 6ebf9fbf..c4eba4b3 100644 --- a/checkmarx-ast-cli.version +++ b/checkmarx-ast-cli.version @@ -1 +1 @@ -2.3.33 +2.3.35 diff --git a/src/main/wrapper/resources/cx-linux b/src/main/wrapper/resources/cx-linux index 6a190ceb..5dff3bf0 100755 --- a/src/main/wrapper/resources/cx-linux +++ b/src/main/wrapper/resources/cx-linux @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bd90806fae564acc02fc8aaa654168d3f7cece9fa64fddfa4db41300032bca8d -size 80113848 +oid sha256:8613abbbd4a1a5b16dece3bfdca268f0ef54bea47d779c0fc7b6f2d590bb7bb6 +size 80122040 diff --git a/src/main/wrapper/resources/cx-mac b/src/main/wrapper/resources/cx-mac index 27db40b1..b2787ac8 100755 --- a/src/main/wrapper/resources/cx-mac +++ b/src/main/wrapper/resources/cx-mac @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c078e157df7c0afb379a37570c1b1b00fdde502985b400ababd9de8e116400e1 -size 161259440 +oid sha256:81b18ae0206cf44631c6e28a4c08c12c4f198dd2dd4c74635a7d2c8e617117b0 +size 161276144 diff --git a/src/main/wrapper/resources/cx.exe b/src/main/wrapper/resources/cx.exe index 2e370a56..bdaa5513 100644 --- a/src/main/wrapper/resources/cx.exe +++ b/src/main/wrapper/resources/cx.exe @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:231b3cde441c40800b59876ff3efaade94fb607bc7d920c2a96a8306eaf1b5d2 -size 82096064 +oid sha256:6250391706fb243d66bba9b5d565f94032b23b681832bcc9b9512d59c7eca71b +size 82100160 From 239c2553adc2e575a25e48dc4a8251230ad7cbb2 Mon Sep 17 00:00:00 2001 From: Ben Alvo <144705560+cx-ben-alvo@users.noreply.github.com> Date: Mon, 15 Sep 2025 13:53:33 +0300 Subject: [PATCH 4/4] Update update-cli.yml --- .github/workflows/update-cli.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-cli.yml b/.github/workflows/update-cli.yml index 5501c04b..5c287328 100644 --- a/.github/workflows/update-cli.yml +++ b/.github/workflows/update-cli.yml @@ -59,7 +59,7 @@ jobs: if: steps.checkmarx-ast-cli.outputs.current_tag != steps.checkmarx-ast-cli.outputs.release_tag uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c #v6 with: - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.AUTOMATION_TOKEN }} commit-message: Update checkmarx-ast-cli to ${{ steps.checkmarx-ast-cli.outputs.release_tag }} title: Update checkmarx-ast-cli binaries with ${{ steps.checkmarx-ast-cli.outputs.release_tag }} body: |