Skip to content

Commit

Permalink
Fixed cx-summary property (#1291)
Browse files Browse the repository at this point in the history
* Fixed cx-summary property

* Updated dockerfile

* Updated test cases

* Update Dockerfile
  • Loading branch information
itsKedar authored Nov 20, 2023
1 parent d920bd5 commit 4ee49d6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ WORKDIR app
RUN apk update && \
apk upgrade && \
apk upgrade
RUN apk add openjdk8=8.372.07-r0 --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community
RUN apk add openjdk8=8.392.08-r0 --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community
ENV JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk
RUN apk add libstdc++
RUN apk add glib
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/com/checkmarx/flow/config/RepoProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public class RepoProperties {
private boolean detailed = true;
private boolean flowSummary = true;
private String flowSummaryHeader = PullRequestCommentsHelper.COMMENT_TYPE_SAST_FINDINGS_2;
private boolean cxSummary = false;
private boolean cxSummary = true;
private boolean cxTableSummary = false;
private String cxSummaryHeader = "Checkmarx Scan Summary";
private Map<String, OptionalScmInstanceProperties> optionalInstances;
private boolean scanSubmittedComment = true;
Expand Down Expand Up @@ -108,6 +109,13 @@ public String getCloseTransition() {
public void setCloseTransition(String closeTransition) {
this.closeTransition = closeTransition;
}
public boolean isCxTableSummary() {
return cxTableSummary;
}

public void setCxTableSummary(boolean cxTableSummary) {
this.cxTableSummary = cxTableSummary;
}

public String getFilePath() {
return filePath;
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/com/checkmarx/flow/utils/HTMLHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -710,12 +710,13 @@ private static void addOsaDetailesBody(ScanResults results, StringBuilder body,

private static void addScanSummarySection(ScanRequest request, ScanResults results, RepoProperties properties, StringBuilder body) {
setScannerLogoHeader(request, results, body);
setScannerSummaryHeader(results, body);

CxScanSummary summary = results.getScanSummary();
setScannerTotalVulnerabilities(body, summary, request);

if (properties.isCxSummary() && !request.getProduct().equals(ScanRequest.Product.CXOSA)) {
if(properties.isCxSummary())
{
setScannerSummaryHeader(results, body);
setScannerTotalVulnerabilities(body, summary, request);
}
if (properties.isCxTableSummary() && !request.getProduct().equals(ScanRequest.Product.CXOSA)) {
if (!ScanUtils.empty(properties.getCxSummaryHeader())) {
appendAll(body, MarkDownHelper.getMdHeaderType(4, properties.getCxSummaryHeader()), CRLF);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ private ScanRequest getBasicRequest() {
}

private void initGitHubProperties() {
this.gitHubProperties.setCxSummary(false);
this.gitHubProperties.setCxSummary(true);
this.gitHubProperties.setFlowSummary(false);
this.gitHubProperties.setUrl(GITHUB_URL);
this.gitHubProperties.setWebhookToken("1234");
Expand Down

0 comments on commit 4ee49d6

Please sign in to comment.