Skip to content

Commit 717e7fc

Browse files
Activate SCS engine support for JetBrains plugin (#440)
* Activate SCS engine support for JetBrains plugin
1 parent 2eede30 commit 717e7fc

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

src/main/java/com/checkmarx/ast/results/result/Data.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ public class Data {
3131
List<Node> nodes;
3232
List<PackageData> packageData;
3333
ScaPackageData scaPackageData;
34+
// Secret Detection specific fields
35+
String ruleName;
36+
String ruleDescription;
37+
String remediation;
3438

3539
public Data(@JsonProperty("queryId") String queryId,
3640
@JsonProperty("queryName") String queryName,
@@ -47,7 +51,10 @@ public Data(@JsonProperty("queryId") String queryId,
4751
@JsonProperty("line") int line,
4852
@JsonProperty("nodes") List<Node> nodes,
4953
@JsonProperty("packageData") List<PackageData> packageData,
50-
@JsonProperty("scaPackageData") ScaPackageData scaPackageData) {
54+
@JsonProperty("scaPackageData") ScaPackageData scaPackageData,
55+
@JsonProperty("ruleName") String ruleName,
56+
@JsonProperty("ruleDescription") String ruleDescription,
57+
@JsonProperty("remediation") String remediation) {
5158
this.queryId = queryId;
5259
this.queryName = queryName;
5360
this.group = group;
@@ -64,5 +71,8 @@ public Data(@JsonProperty("queryId") String queryId,
6471
this.nodes = nodes;
6572
this.packageData = packageData;
6673
this.scaPackageData = scaPackageData;
74+
this.ruleName = ruleName;
75+
this.ruleDescription = ruleDescription;
76+
this.remediation = remediation;
6777
}
6878
}

src/main/java/com/checkmarx/ast/results/result/Result.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.checkmarx.ast.results.result;
22

3+
import com.checkmarx.ast.wrapper.CxConstants;
34
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
45
import com.fasterxml.jackson.annotation.JsonInclude;
56
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -53,7 +54,7 @@ public Result(@JsonProperty("type") String type,
5354
@JsonProperty("comments") Comments comments,
5455
@JsonProperty("vulnerabilityDetails") VulnerabilityDetails vulnerabilityDetails,
5556
@JsonProperty("scaType") String scaType) {
56-
this.type = type;
57+
this.type = normalizeType(type);
5758
this.scaType=scaType;
5859
this.label = label;
5960
this.id = id;
@@ -74,4 +75,14 @@ public Result(@JsonProperty("type") String type,
7475
this.comments = comments;
7576
this.vulnerabilityDetails = vulnerabilityDetails;
7677
}
78+
79+
/**
80+
* Normalizes special-case types coming from JSON into internal constants.
81+
*/
82+
private static String normalizeType(String rawType) {
83+
if ("sscs-secret-detection".equals(rawType)) {
84+
return CxConstants.SECRET_DETECTION;
85+
}
86+
return rawType; // leave other engine types unchanged
87+
}
7788
}

src/main/java/com/checkmarx/ast/wrapper/CxConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public final class CxConstants {
1313
public static final String AGENT = "--agent";
1414
public static final String SAST = "sast";
1515
public static final String DEBUG = "--debug";
16+
public static final String SECRET_DETECTION = "scs";
1617
static final String CLIENT_ID = "--client-id";
1718
static final String CLIENT_SECRET = "--client-secret";
1819
static final String API_KEY = "--apikey";

0 commit comments

Comments
 (0)