Search in sources :

Example 1 with StatusCounter

use of com.checkmarx.sdk.dto.ast.report.StatusCounter in project cx-flow by checkmarx-ltd.

the class GitHubCommentsASTSteps method createFakeASTScanResults.

private ScanResults createFakeASTScanResults(int highCount, int mediumCount, int lowCount) {
    ScanResults result = new ScanResults();
    ASTResults astResults = new ASTResults();
    List<Finding> findings = new LinkedList<>();
    astResults.setScanId("" + SCAN_ID);
    boolean addNodes = false;
    if (highCount + mediumCount + lowCount > 0) {
        addNodes = true;
    }
    List<StatusCounter> findingCounts = new LinkedList<>();
    addFinding(highCount, findingCounts, findings, Severity.HIGH.name(), addNodes, "SQL_INJECTION");
    addFinding(mediumCount, findingCounts, findings, Severity.MEDIUM.name(), addNodes, "Hardcoded_password_in_Connection_String");
    addFinding(lowCount, findingCounts, findings, Severity.LOW.name(), addNodes, "Open_Redirect");
    astResults.setFindings(findings);
    result.setAstResults(astResults);
    AstSummaryResults summary = new AstSummaryResults();
    summary.setStatusCounters(findingCounts);
    summary.setHighVulnerabilityCount(highCount);
    summary.setMediumVulnerabilityCount(mediumCount);
    summary.setLowVulnerabilityCount(lowCount);
    astResults.setWebReportLink(AST_WEB_REPORT_LINK);
    astResults.setSummary(summary);
    Map<String, Object> details = new HashMap<>();
    details.put(Constants.SUMMARY_KEY, new HashMap<>());
    result.setAdditionalDetails(details);
    return result;
}
Also used : ScanResults(com.checkmarx.sdk.dto.ScanResults) StatusCounter(com.checkmarx.sdk.dto.ast.report.StatusCounter) AstSummaryResults(com.checkmarx.sdk.dto.ast.report.AstSummaryResults) Finding(com.checkmarx.sdk.dto.ast.report.Finding)

Example 2 with StatusCounter

use of com.checkmarx.sdk.dto.ast.report.StatusCounter in project cx-flow by checkmarx-ltd.

the class GitHubCommentsASTSteps method addFinding.

private void addFinding(Integer countFindingsPerSeverity, List<StatusCounter> findingCounts, List<Finding> findings, String severity, boolean addNodes, String queryName) {
    for (int i = 0; i < countFindingsPerSeverity; i++) {
        Finding fnd = new Finding();
        fnd.setSeverity(severity);
        fnd.setQueryName(queryName + "-" + i);
        if (addNodes) {
            addNodes(fnd);
        }
        findings.add(fnd);
    }
    StatusCounter statusCounter = new StatusCounter();
    statusCounter.setStatus(severity);
    statusCounter.setCounter(countFindingsPerSeverity);
    findingCounts.add(statusCounter);
}
Also used : Finding(com.checkmarx.sdk.dto.ast.report.Finding) StatusCounter(com.checkmarx.sdk.dto.ast.report.StatusCounter)

Aggregations

Finding (com.checkmarx.sdk.dto.ast.report.Finding)2 StatusCounter (com.checkmarx.sdk.dto.ast.report.StatusCounter)2 ScanResults (com.checkmarx.sdk.dto.ScanResults)1 AstSummaryResults (com.checkmarx.sdk.dto.ast.report.AstSummaryResults)1