Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
bfaa9d3
aimcp server changes
cx-atish-jadhav Oct 14, 2025
994bec4
oss-realtime scanner changes
cx-atish-jadhav Oct 14, 2025
f741fa1
Create OssRealtimeVulnerability.java
cx-atish-jadhav Oct 14, 2025
1551319
Unify realtime scan wrappers; consolidate Secrets/IaC models; depreca…
cx-atish-jadhav Oct 15, 2025
decc733
Add ContainersRealtimeVulnerability model for containers realtime sca…
cx-atish-jadhav Oct 15, 2025
1ac5286
Add @JsonCreator constructor to OssRealtimeVulnerability for reliable…
cx-atish-jadhav Oct 15, 2025
fa9f1b5
Refactoring package name and adding test for oss and mcp flag
cx-atish-jadhav Oct 16, 2025
ece0319
Add integration tests for OSS, Container, and Secrets realtime scanners
cx-atish-jadhav Nov 10, 2025
a395d91
Replaced Id to CVE in oss vulnerability
cx-atish-jadhav Nov 25, 2025
5564f93
Changed variable from id to CVE as per OSS response
cx-anand-nandeshwar Nov 25, 2025
95ee628
Merge remote-tracking branch 'origin/feature/agentic_ai' into feature…
cx-anand-nandeshwar Nov 25, 2025
1810e78
aimcp server changes
cx-atish-jadhav Oct 14, 2025
bf95eb7
oss-realtime scanner changes
cx-atish-jadhav Oct 14, 2025
7c72274
Create OssRealtimeVulnerability.java
cx-atish-jadhav Oct 14, 2025
0677502
Unify realtime scan wrappers; consolidate Secrets/IaC models; depreca…
cx-atish-jadhav Oct 15, 2025
2f0f55b
Add ContainersRealtimeVulnerability model for containers realtime sca…
cx-atish-jadhav Oct 15, 2025
d1cb41c
Add @JsonCreator constructor to OssRealtimeVulnerability for reliable…
cx-atish-jadhav Oct 15, 2025
b2f2588
Refactoring package name and adding test for oss and mcp flag
cx-atish-jadhav Oct 16, 2025
d647f57
Add integration tests for OSS, Container, and Secrets realtime scanners
cx-atish-jadhav Nov 10, 2025
ee4c90c
Changed variable from id to CVE as per OSS response
cx-anand-nandeshwar Nov 25, 2025
97c6c69
Add maskedResult for secret remediation and change log level from INF…
cx-atish-jadhav Dec 1, 2025
82d6c66
Remove masked secrets functionality from codebase
cx-atish-jadhav Dec 3, 2025
23ddb2d
Implemented mask cmd in java wrapper
cx-atish-jadhav Dec 11, 2025
dbd2b51
Added fix for containerTool for IAC
cx-anjali-deore Dec 18, 2025
04b7efb
Merge branch 'feature/agentic_ai' of https://github.com/CheckmarxDev/…
cx-anjali-deore Dec 18, 2025
13c6f10
Add telemetry AI command with full parameter support and tests
cx-atish-jadhav Dec 23, 2025
36872e6
Add ignoredFilePath parameter to ScanAsca method
cx-atish-jadhav Dec 24, 2025
65d7e2a
Removing ASCA ignore file path changes
cx-atish-jadhav Dec 29, 2025
00ab820
Squashed commit of the following:
cx-atish-jadhav Dec 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/main/java/com/checkmarx/ast/wrapper/CxConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,13 @@ public final class CxConstants {
static final String SUB_CMD_CONTAINERS_REALTIME = "containers-realtime";
static final String SUB_CMD_MASK = "mask";
static final String RESULT_FILE = "--result-file";
static final String CMD_TELEMETRY = "telemetry";
static final String SUB_CMD_TELEMETRY_AI = "ai";
static final String AI_PROVIDER = "--ai-provider";
static final String TYPE = "--type";
static final String SUB_TYPE = "--sub-type";
static final String PROBLEM_SEVERITY = "--problem-severity";
static final String SCAN_TYPE_FLAG = "--scan-type";
static final String STATUS = "--status";
static final String TOTAL_COUNT = "--total-count";
}
67 changes: 59 additions & 8 deletions src/main/java/com/checkmarx/ast/wrapper/CxWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ public KicsRealtimeResults kicsRealtimeScan(@NonNull String fileSources, String
return Execution.executeCommand(withConfigArguments(arguments), logger, KicsRealtimeResults::fromLine);
}

public <T> T realtimeScan(@NonNull String subCommand, @NonNull String sourcePath, String ignoredFilePath, java.util.function.Function<String, T> resultParser)
public <T> T realtimeScan(@NonNull String subCommand, @NonNull String sourcePath, String containerTool, String ignoredFilePath, java.util.function.Function<String, T> resultParser)
throws IOException, InterruptedException, CxException {
this.logger.info("Executing 'scan {}' command using the CLI.", subCommand);
this.logger.info("Source: {} IgnoredFilePath: {}", sourcePath, ignoredFilePath);
Expand All @@ -418,6 +418,10 @@ public <T> T realtimeScan(@NonNull String subCommand, @NonNull String sourcePath
arguments.add(subCommand);
arguments.add(CxConstants.SOURCE);
arguments.add(sourcePath);
if(StringUtils.isNotBlank(containerTool)){
arguments.add(CxConstants.ENGINE);
arguments.add(containerTool);
}
if (StringUtils.isNotBlank(ignoredFilePath)) {
arguments.add(CxConstants.IGNORED_FILE_PATH);
arguments.add(ignoredFilePath);
Expand All @@ -428,27 +432,26 @@ public <T> T realtimeScan(@NonNull String subCommand, @NonNull String sourcePath
// OSS Realtime
public OssRealtimeResults ossRealtimeScan(@NonNull String sourcePath, String ignoredFilePath)
throws IOException, InterruptedException, CxException {
return realtimeScan(CxConstants.SUB_CMD_OSS_REALTIME, sourcePath, ignoredFilePath, OssRealtimeResults::fromLine);
return realtimeScan(CxConstants.SUB_CMD_OSS_REALTIME, sourcePath,"", ignoredFilePath, OssRealtimeResults::fromLine);
}

// IAC Realtime
public IacRealtimeResults iacRealtimeScan(@NonNull String sourcePath, String ignoredFilePath)
public IacRealtimeResults iacRealtimeScan(@NonNull String sourcePath,String containerTool, String ignoredFilePath)
throws IOException, InterruptedException, CxException {
return realtimeScan(CxConstants.SUB_CMD_IAC_REALTIME, sourcePath, ignoredFilePath, IacRealtimeResults::fromLine);
return realtimeScan(CxConstants.SUB_CMD_IAC_REALTIME, sourcePath,containerTool, ignoredFilePath, IacRealtimeResults::fromLine);
}


// Secrets Realtime
public SecretsRealtimeResults secretsRealtimeScan(@NonNull String sourcePath, String ignoredFilePath)
throws IOException, InterruptedException, CxException {
return realtimeScan(CxConstants.SUB_CMD_SECRETS_REALTIME, sourcePath, ignoredFilePath, SecretsRealtimeResults::fromLine);
return realtimeScan(CxConstants.SUB_CMD_SECRETS_REALTIME, sourcePath,"", ignoredFilePath, SecretsRealtimeResults::fromLine);
}



// Containers Realtime
public ContainersRealtimeResults containersRealtimeScan(@NonNull String sourcePath, String ignoredFilePath)
throws IOException, InterruptedException, CxException {
return realtimeScan(CxConstants.SUB_CMD_CONTAINERS_REALTIME, sourcePath, ignoredFilePath, ContainersRealtimeResults::fromLine);
return realtimeScan(CxConstants.SUB_CMD_CONTAINERS_REALTIME, sourcePath, "",ignoredFilePath, ContainersRealtimeResults::fromLine);
}

public KicsRemediation kicsRemediate(@NonNull String resultsFile, String kicsFile, String engine,String similarityIds)
Expand Down Expand Up @@ -534,6 +537,54 @@ public MaskResult maskSecrets(@NonNull String filePath) throws CxException, IOEx
return Execution.executeCommand(withConfigArguments(arguments), logger, MaskResult::fromLine);
}

/**
* Executes telemetry AI command to collect telemetry data for user interactions related to AI features.
*
* @param aiProvider AI provider name (e.g., "Copilot")
* @param agent Agent name (e.g., "Jetbrains")
* @param eventType Event type (e.g., "click")
* @param subType Event subtype (e.g., "ast-results.viewPackageDetails")
* @param engine Engine type (e.g., "secrets")
* @param problemSeverity Severity level (e.g., "high")
* @param scanType Type of scan
* @param status Status information
* @param totalCount Number count
* @return Command output as string
* @throws IOException if I/O error occurs
* @throws InterruptedException if command execution is interrupted
* @throws CxException if CLI command fails
*/
public String telemetryAIEvent(String aiProvider, String agent, String eventType, String subType,
String engine, String problemSeverity, String scanType, String status,
Integer totalCount) throws IOException, InterruptedException, CxException {
this.logger.info("Executing telemetry AI event with provider: {}, type: {}, subType: {}",
aiProvider, eventType, subType);

List<String> arguments = new ArrayList<>();
arguments.add(CxConstants.CMD_TELEMETRY);
arguments.add(CxConstants.SUB_CMD_TELEMETRY_AI);
arguments.add(CxConstants.AI_PROVIDER);
arguments.add(aiProvider);
arguments.add(CxConstants.AGENT);
arguments.add(agent);
arguments.add(CxConstants.TYPE);
arguments.add(eventType);
arguments.add(CxConstants.SUB_TYPE);
arguments.add(subType);
arguments.add(CxConstants.ENGINE);
arguments.add(engine);
arguments.add(CxConstants.PROBLEM_SEVERITY);
arguments.add(problemSeverity);
arguments.add(CxConstants.SCAN_TYPE_FLAG);
arguments.add(scanType);
arguments.add(CxConstants.STATUS);
arguments.add(status);
arguments.add(CxConstants.TOTAL_COUNT);
arguments.add(totalCount.toString());

return Execution.executeCommand(withConfigArguments(arguments), logger, line -> line);
}

private int getIndexOfBfLNode(List<Node> bflNodes, List<Node> resultNodes) {

int bflNodeNotFound = -1;
Expand Down
67 changes: 67 additions & 0 deletions src/test/java/com/checkmarx/ast/TelemetryTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package com.checkmarx.ast;

import com.checkmarx.ast.wrapper.CxException;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import java.io.IOException;

/**
* Telemetry AI event test cases covering various parameter scenarios.
*/
class TelemetryTest extends BaseTest {

@Test
void testTelemetryAIEventSuccessfulCaseWithMinimalParametersAiLog() throws CxException, IOException, InterruptedException {
// Test case: AI logging with specific parameters and some empty values
Assertions.assertDoesNotThrow(() -> {
String result = wrapper.telemetryAIEvent(
"Cursor", // aiProvider
"Cursos", // agent
"click", // eventType
"ast-results.viewPackageDetails", // subType
"secrets", // engine
"high", // problemSeverity
"", // scanType (empty)
"", // status (empty)
0 // totalCount
);
}, "Telemetry AI event should execute successfully");
}

@Test
void testTelemetryAIEventSuccessfulCaseWithMinimalParametersDetectionLog() throws CxException, IOException, InterruptedException {
// Test case: Detection logging with most parameters empty and specific scan data
Assertions.assertDoesNotThrow(() -> {
String result = wrapper.telemetryAIEvent(
"", // aiProvider (empty)
"", // agent (empty)
"", // eventType (empty)
"", // subType (empty)
"", // engine (empty)
"", // problemSeverity (empty)
"asca", // scanType
"Critical", // status
10 // totalCount
);
}, "Telemetry AI event should execute successfully for detection log");
}

@Test
void testTelemetryAIEventSuccessfulCaseWithEdgeCaseParameters() throws CxException, IOException, InterruptedException {
// Test case: Edge case with minimal required parameters
Assertions.assertDoesNotThrow(() -> {
String result = wrapper.telemetryAIEvent(
"test-provider", // aiProvider (minimal value)
"java-wrapper", // agent (minimal value)
"", // eventType (empty)
"", // subType (empty)
"", // engine (empty)
"", // problemSeverity (empty)
"", // scanType (empty)
"", // status (empty)
0 // totalCount
);
}, "Telemetry AI event should execute successfully for edge case");
}
}