Search in sources :

Example 11 with CxScanSummary

use of com.checkmarx.sdk.dto.cx.CxScanSummary in project cx-flow by checkmarx-ltd.

the class HTMLHelper method addScanSummarySection.

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 (!ScanUtils.empty(properties.getCxSummaryHeader())) {
            appendAll(body, MarkDownHelper.getMdHeaderType(4, properties.getCxSummaryHeader()), CRLF);
        }
        MarkDownHelper.appendMDtableHeaders(body, SEVERITY, "Count");
        MarkDownHelper.appendMDtableRow(body, "High", summary.getHighSeverity().toString());
        MarkDownHelper.appendMDtableRow(body, "Medium", summary.getMediumSeverity().toString());
        MarkDownHelper.appendMDtableRow(body, "Low", summary.getLowSeverity().toString());
        MarkDownHelper.appendMDtableRow(body, "Informational", summary.getInfoSeverity().toString());
        body.append(CRLF);
    }
}
Also used : CxScanSummary(com.checkmarx.sdk.dto.cx.CxScanSummary)

Example 12 with CxScanSummary

use of com.checkmarx.sdk.dto.cx.CxScanSummary in project cx-flow by checkmarx-ltd.

the class ScanUtils method setAstScanSummary.

private static void setAstScanSummary(ScanResults results) {
    CxScanSummary scanSummary = new CxScanSummary();
    scanSummary.setHighSeverity(results.getAstResults().getSummary().getHighVulnerabilityCount());
    scanSummary.setMediumSeverity(results.getAstResults().getSummary().getMediumVulnerabilityCount());
    scanSummary.setLowSeverity(results.getAstResults().getSummary().getLowVulnerabilityCount());
    scanSummary.setInfoSeverity(0);
    results.setLink(results.getAstResults().getWebReportLink());
    results.setScanSummary(scanSummary);
}
Also used : CxScanSummary(com.checkmarx.sdk.dto.cx.CxScanSummary)

Example 13 with CxScanSummary

use of com.checkmarx.sdk.dto.cx.CxScanSummary in project cx-flow by checkmarx-ltd.

the class FilterScriptSteps method getCxClientSpy.

private CxClient getCxClientSpy(RestTemplate restTemplateMock, CxAuthService authClientMock) throws CheckmarxException {
    CxClient cxClient = new CxService(authClientMock, cxProperties, cxLegacyService, restTemplateMock, null, filterInputFactory, filterValidator);
    CxClient cxClientSpy = spy(cxClient);
    doReturn(new CxScanSummary()).when(cxClientSpy).getScanSummaryByScanId(any());
    return cxClientSpy;
}
Also used : CxClient(com.checkmarx.sdk.service.scanner.CxClient) CxScanSummary(com.checkmarx.sdk.dto.cx.CxScanSummary)

Example 14 with CxScanSummary

use of com.checkmarx.sdk.dto.cx.CxScanSummary in project cx-flow by checkmarx-ltd.

the class Github2AdoSteps method createFakeResults.

private ScanResults createFakeResults() {
    ScanResults result = new ScanResults();
    result.setScanSummary(new CxScanSummary());
    Map<String, Object> details = new HashMap<>();
    details.put(Constants.SUMMARY_KEY, new HashMap<>());
    if (scannerType.equals(AST)) {
        createAstFindings(result);
    }
    result.setAdditionalDetails(details);
    result.setXIssues(ScanResultsBuilder.get2XIssues());
    return result;
}
Also used : ScanResults(com.checkmarx.sdk.dto.ScanResults) CxScanSummary(com.checkmarx.sdk.dto.cx.CxScanSummary)

Example 15 with CxScanSummary

use of com.checkmarx.sdk.dto.cx.CxScanSummary in project cx-flow by checkmarx-ltd.

the class CxConfigSteps method createFakeScanResults.

private static ScanResults createFakeScanResults() {
    ScanResults result = new ScanResults();
    result.setScanSummary(new CxScanSummary());
    Map<String, Object> details = new HashMap<>();
    details.put(Constants.SUMMARY_KEY, new HashMap<>());
    result.setAdditionalDetails(details);
    result.setXIssues(new ArrayList<>());
    return result;
}
Also used : ScanResults(com.checkmarx.sdk.dto.ScanResults) CxScanSummary(com.checkmarx.sdk.dto.cx.CxScanSummary)

Aggregations

CxScanSummary (com.checkmarx.sdk.dto.cx.CxScanSummary)15 ScanResults (com.checkmarx.sdk.dto.ScanResults)6 JSONObject (org.json.JSONObject)2 ASTResults (com.checkmarx.sdk.dto.ast.ASTResults)1 AstSummaryResults (com.checkmarx.sdk.dto.ast.report.AstSummaryResults)1 Finding (com.checkmarx.sdk.dto.ast.report.Finding)1 SCAResults (com.checkmarx.sdk.dto.sca.SCAResults)1 Summary (com.checkmarx.sdk.dto.sca.Summary)1 Finding (com.checkmarx.sdk.dto.sca.report.Finding)1 Package (com.checkmarx.sdk.dto.sca.report.Package)1 CheckmarxException (com.checkmarx.sdk.exception.CheckmarxException)1 CxClient (com.checkmarx.sdk.service.scanner.CxClient)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1 LinkedMultiValueMap (org.springframework.util.LinkedMultiValueMap)1 MultiValueMap (org.springframework.util.MultiValueMap)1