Skip to content

Commit 29609c6

Browse files
cx-ben-alvogithub-actions[bot]github-actions
authored
Add new telemetry fields to telemetryAIEvent method (AST-113145) (#898)
* Add new telemetry fields to telemetryAIEvent method (AST-113145) * Update token in update-cli.yml to use GITHUB_TOKEN * 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 <github-actions@github.com> Co-authored-by: cx-ben-alvo <144705560+cx-ben-alvo@users.noreply.github.com> * Update update-cli.yml --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions <github-actions@github.com>
1 parent 1a1ce3e commit 29609c6

File tree

7 files changed

+44
-15
lines changed

7 files changed

+44
-15
lines changed

checkmarx-ast-cli.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.33
1+
2.3.35

src/main/wrapper/CxConstants.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,5 +122,8 @@ export enum CxConstants {
122122
AI_PROVIDER = "--ai-provider",
123123
TYPE = "--type",
124124
SUB_TYPE = "--sub-type",
125-
PROBLEM_SEVERITY = "--problem-severity"
125+
PROBLEM_SEVERITY = "--problem-severity",
126+
SCAN_TYPE_FLAG = "--scan-type",
127+
STATUS = "--status",
128+
TOTAL_COUNT = "--total-count",
126129
}

src/main/wrapper/CxWrapper.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ export class CxWrapper {
530530
return new ExecutionService().executeCommands(this.config.pathToExecutable, commands, CxConstants.MASK_TYPE);
531531
}
532532

533-
telemetryAIEvent(aiProvider: string, agent: string, eventType: string, subType: string, engine: string, problemSeverity: string): Promise<CxCommandOutput> {
533+
telemetryAIEvent(aiProvider: string, agent: string, eventType: string, subType: string, engine: string, problemSeverity: string, scanType: string, status: string, totalCount: number): Promise<CxCommandOutput> {
534534
const commands: string[] = [
535535
CxConstants.TELEMETRY,
536536
CxConstants.SUB_CMD_TELEMETRY_AI,
@@ -539,7 +539,10 @@ export class CxWrapper {
539539
CxConstants.TYPE, eventType,
540540
CxConstants.SUB_TYPE, subType,
541541
CxConstants.ENGINE, engine,
542-
CxConstants.PROBLEM_SEVERITY, problemSeverity
542+
CxConstants.PROBLEM_SEVERITY, problemSeverity,
543+
CxConstants.SCAN_TYPE_FLAG, scanType,
544+
CxConstants.STATUS, status,
545+
CxConstants.TOTAL_COUNT, totalCount.toString()
543546
];
544547
commands.push(...this.initializeCommands(false));
545548
const exec = new ExecutionService();
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:bd90806fae564acc02fc8aaa654168d3f7cece9fa64fddfa4db41300032bca8d
3-
size 80113848
2+
oid sha256:8613abbbd4a1a5b16dece3bfdca268f0ef54bea47d779c0fc7b6f2d590bb7bb6
3+
size 80122040

src/main/wrapper/resources/cx-mac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:c078e157df7c0afb379a37570c1b1b00fdde502985b400ababd9de8e116400e1
3-
size 161259440
2+
oid sha256:81b18ae0206cf44631c6e28a4c08c12c4f198dd2dd4c74635a7d2c8e617117b0
3+
size 161276144

src/main/wrapper/resources/cx.exe

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:231b3cde441c40800b59876ff3efaade94fb607bc7d920c2a96a8306eaf1b5d2
3-
size 82096064
2+
oid sha256:6250391706fb243d66bba9b5d565f94032b23b681832bcc9b9512d59c7eca71b
3+
size 82100160

src/tests/TelemetryTest.test.ts

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,55 @@ import { BaseTest } from "./BaseTest";
55
describe("Telemetry cases", () => {
66
const cxScanConfig = new BaseTest();
77

8-
it.skip('TelemetryAIEvent Successful case with minimal parameters', async () => {
8+
it('TelemetryAIEvent Successful case with minimal parameters - ai log', async () => {
99
const wrapper = new CxWrapper(cxScanConfig);
1010
const cxCommandOutput: CxCommandOutput = await wrapper.telemetryAIEvent(
1111
"Cursor",
1212
"Cursos",
1313
"click",
1414
"ast-results.viewPackageDetails",
1515
"secrets",
16-
"high"
16+
"high",
17+
"",
18+
"",
19+
0
20+
);
21+
console.log("Json object from telemetryAIEvent successful case: " + JSON.stringify(cxCommandOutput));
22+
expect(cxCommandOutput.exitCode).toBe(0);
23+
});
24+
25+
it('TelemetryAIEvent Successful case with minimal parameters - detection log', async () => {
26+
const wrapper = new CxWrapper(cxScanConfig);
27+
const cxCommandOutput: CxCommandOutput = await wrapper.telemetryAIEvent(
28+
"",
29+
"",
30+
"",
31+
"",
32+
"",
33+
"",
34+
"asca",
35+
"Critical",
36+
10
1737
);
1838
console.log("Json object from telemetryAIEvent successful case: " + JSON.stringify(cxCommandOutput));
1939
expect(cxCommandOutput.exitCode).toBe(0);
2040
});
2141

2242

23-
it.skip('TelemetryAIEvent Successful case with edge case parameters', async () => {
43+
it('TelemetryAIEvent Successful case with edge case parameters', async () => {
2444
const wrapper = new CxWrapper(cxScanConfig);
2545
const cxCommandOutput: CxCommandOutput = await wrapper.telemetryAIEvent(
2646
"",
2747
"",
2848
"",
2949
"",
3050
"",
31-
""
51+
"",
52+
"",
53+
"",
54+
0
3255
);
3356
console.log("Json object from telemetryAIEvent with empty parameters: " + JSON.stringify(cxCommandOutput));
34-
expect(typeof cxCommandOutput.exitCode).toBe(0);
57+
expect(cxCommandOutput.exitCode).toBe(0);
3558
});
3659
});

0 commit comments

Comments
 (0)