use of com.checkmarx.sdk.dto.ScanResults in project cx-flow by checkmarx-ltd.
the class ScaPolicyManagementSteps method initNewScan.
@When("initiating a new scan")
public void initNewScan() {
ScanRequest scanRequest = getBasicScanRequest(PROJECT_NAME, GIT_REPO_URL);
ScanResults scanResults = scaScanner.scan(scanRequest);
scaResults = Objects.requireNonNull(scanResults).getScaResults();
}
use of com.checkmarx.sdk.dto.ScanResults in project cx-flow by checkmarx-ltd.
the class GetResultsAnalyticsTestSteps method createFakeSASTScanResults.
private static ScanResults createFakeSASTScanResults() {
ScanResults result = new ScanResults();
CxScanSummary summary = new CxScanSummary();
result.setScanSummary(summary);
Map<String, Object> details = new HashMap<>();
details.put(Constants.SUMMARY_KEY, new HashMap<>());
result.setAdditionalDetails(details);
result.setXIssues(new ArrayList<>());
return result;
}
use of com.checkmarx.sdk.dto.ScanResults 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;
}
use of com.checkmarx.sdk.dto.ScanResults in project cx-flow by checkmarx-ltd.
the class SCAScanner method cxParseResults.
@Override
protected void cxParseResults(ScanRequest scanRequest, File file) throws ExitThrowable {
RestClientConfig restClientConfig;
IScanClientHelper iScanClientHelper;
try {
ScanParams sdkScanParams = ScanParams.builder().projectName(scanRequest.getProject()).scaConfig(scanRequest.getScaConfig()).filterConfiguration(scanRequest.getFilter()).build();
restClientConfig = scaScannerClient.getScanConfig(sdkScanParams);
iScanClientHelper = new ScaClientHelper(restClientConfig, log, scaProperties);
ScanResults results = iScanClientHelper.getReportContent(file, scanRequest.getFilter());
resultsService.processResults(scanRequest, results, scanDetails);
if (flowProperties.isBreakBuild() && results != null && results.getXIssues() != null && !results.getXIssues().isEmpty()) {
log.error(ERROR_BREAK_MSG);
exit(ExitCode.BUILD_INTERRUPTED);
}
} catch (MachinaException | CheckmarxException e) {
log.error("Error occurred while processing results file", e);
exit(3);
}
}
use of com.checkmarx.sdk.dto.ScanResults in project cx-flow by checkmarx-ltd.
the class ResultsService method processScanResultsAsync.
@Async("scanRequest")
public CompletableFuture<ScanResults> processScanResultsAsync(ScanRequest request, Integer projectId, Integer scanId, String osaScanId, FilterConfiguration filterConfiguration) throws MachinaException {
try {
CompletableFuture<ScanResults> future = new CompletableFuture<>();
// TODO async these, and join and merge after
ScanResults results = cxScannerService.getScannerClient().getReportContentByScanId(scanId, filterConfiguration);
logGetResultsJsonLogger(request, scanId, results);
results = getOSAScan(request, projectId, osaScanId, filterConfiguration, results);
sendEmailNotification(request, results);
processResults(request, results, new ScanDetails(projectId, scanId, osaScanId));
logScanDetails(request, projectId, results);
future.complete(results);
return future;
} catch (Exception e) {
log.error("Error occurred while processing results.", e);
CompletableFuture<ScanResults> x = new CompletableFuture<>();
x.completeExceptionally(e);
return x;
}
}
Aggregations