use of com.checkmarx.flow.dto.report.ScanReport in project cx-flow by checkmarx-ltd.
the class AbstractASTScanner method logRequest.
private void logRequest(ScanRequest request, AstScaResults internalResults, OperationResult scanCreationResult) {
String scanId = getScanId(internalResults);
ScanReport report = new ScanReport(scanId, request, request.getRepoUrl(), scanCreationResult, AnalyticsReport.SCA);
report.log();
}
use of com.checkmarx.flow.dto.report.ScanReport in project cx-flow by checkmarx-ltd.
the class AbstractVulnerabilityScanner method logRequest.
private void logRequest(ScanRequest request, Integer scanId, File cxFile, OperationResult scanCreationResult) {
ScanReport report = new ScanReport(scanId, request, getRepoUrl(request, cxFile), scanCreationResult);
report.log();
}
use of com.checkmarx.flow.dto.report.ScanReport in project cx-flow by checkmarx-ltd.
the class SCARemoteRepoScanSteps method getReportObject.
private ScanReport getReportObject() throws CheckmarxException, JsonProcessingException {
JsonLoggerTestUtils utils = new JsonLoggerTestUtils();
String lastLine = utils.getLastLine();
ObjectMapper objectMapper = new ObjectMapper();
JsonNode jsonNode = objectMapper.readTree(lastLine).get(ScanReport.OPERATION);
if (jsonNode != null) {
return (ScanReport) utils.getAnalyticsReport(ScanReport.class, objectMapper, jsonNode);
} else {
return null;
}
}
use of com.checkmarx.flow.dto.report.ScanReport in project cx-flow by checkmarx-ltd.
the class AbstractVulnerabilityScanner method scan.
@Override
public ScanResults scan(ScanRequest scanRequest) {
log.info("--------------------- Initiating new {} scan ---------------------", SCAN_TYPE);
setRequestParamsByProperties(scanRequest);
checkScanSubmitEmailDelivery(scanRequest);
try {
Integer scanId;
CxScanParams cxScanParams = getScanRequestConverter().toScanParams(scanRequest);
Integer projectId = cxScanParams.getProjectId();
log.info("Checking if there is any existing scan for Project: {}", projectId);
Integer existingScanId = getScannerClient().getScanIdOfExistingScanIfExists(projectId);
String scanComment = getScanComment(scanRequest);
if (existingScanId != UNKNOWN_INT) {
if (!getCxPropertiesBase().getScanQueuing()) {
Boolean scanResubmit = false;
if (scanRequest.getScanResubmit() != null) {
scanResubmit = Boolean.parseBoolean(scanRequest.getScanResubmit());
} else if (flowProperties.getScanResubmit()) {
scanResubmit = flowProperties.getScanResubmit();
}
if (scanResubmit) {
log.info("Existing ongoing scan with id {} found for Project : {}", existingScanId, projectId);
log.info("Aborting the ongoing scan with id {} for Project: {}", existingScanId, projectId);
getScannerClient().cancelScan(existingScanId);
log.info("Resubmitting the scan for Project: {}", projectId);
scanId = getScannerClient().createScan(cxScanParams, scanComment);
} else {
log.warn("Property scan-resubmit set to {} : New scan not submitted, due to existing ongoing scan for the same Project id {}", flowProperties.getScanResubmit(), projectId);
bugTrackers.getBugTrackerEventTrigger().triggerScanNotSubmittedBugTrackerEvent(scanRequest, getEmptyScanResults());
throw new CheckmarxException(String.format("Active Scan with Id %d already exists for Project: %d", existingScanId, projectId));
}
} else {
scanId = getScannerClient().createScan(cxScanParams, scanComment);
}
} else {
scanId = getScannerClient().createScan(cxScanParams, scanComment);
}
return getScanResults(scanRequest, projectId, scanId);
} catch (GitHubRepoUnavailableException e) {
// an error stack trace in the log
return getEmptyScanResults();
} catch (Exception e) {
log.error("SAST scan failed", e);
OperationResult scanCreationFailure = new OperationResult(OperationStatus.FAILURE, e.getMessage());
ScanReport report = new ScanReport(-1, scanRequest, scanRequest.getRepoUrl(), scanCreationFailure);
report.log();
return getEmptyScanResults();
}
}
use of com.checkmarx.flow.dto.report.ScanReport in project cx-flow by checkmarx-ltd.
the class AbstractVulnerabilityScanner method logRequest.
private void logRequest(ScanRequest request, String scanId, File cxFile, OperationResult scanCreationResult) {
ScanReport report = new ScanReport(scanId, request, getRepoUrl(request, cxFile), scanCreationResult);
report.log();
}
Aggregations