diff --git a/src/main/java/com/checkmarx/flow/service/AbstractASTScanner.java b/src/main/java/com/checkmarx/flow/service/AbstractASTScanner.java index d262304f0..7ef916344 100644 --- a/src/main/java/com/checkmarx/flow/service/AbstractASTScanner.java +++ b/src/main/java/com/checkmarx/flow/service/AbstractASTScanner.java @@ -57,7 +57,9 @@ public ScanResults scan(ScanRequest scanRequest) { logRequest(scanRequest, internalResults, OperationResult.successful()); result = toScanResults(internalResults); } catch (Exception e) { + bugTrackerEventTrigger.triggerOffScanStartedEvent(scanRequest); treatError(scanRequest, internalResults, e); + } return result; diff --git a/src/main/java/com/checkmarx/flow/service/AbstractVulnerabilityScanner.java b/src/main/java/com/checkmarx/flow/service/AbstractVulnerabilityScanner.java index cb7ab1596..a8abdaf4a 100644 --- a/src/main/java/com/checkmarx/flow/service/AbstractVulnerabilityScanner.java +++ b/src/main/java/com/checkmarx/flow/service/AbstractVulnerabilityScanner.java @@ -112,6 +112,7 @@ public ScanResults scan(ScanRequest scanRequest) { //usually should occur during push event occurring on delete branch //therefore need to eliminate the scan process but do not want to create //an error stack trace in the log + bugTrackers.getBugTrackerEventTrigger().triggerOffScanStartedEvent(scanRequest); return getEmptyScanResults(); } catch (Exception e) { @@ -119,6 +120,7 @@ public ScanResults scan(ScanRequest scanRequest) { OperationResult scanCreationFailure = new OperationResult(OperationStatus.FAILURE, e.getMessage()); ScanReport report = new ScanReport(-1, scanRequest, scanRequest.getRepoUrl(), scanCreationFailure); report.log(); + bugTrackers.getBugTrackerEventTrigger().triggerOffScanStartedEvent(scanRequest); return getEmptyScanResults(); } } @@ -290,6 +292,8 @@ private ScanResults getEmptyScanResults() { scanResults.setProjectId(UNKNOWN); scanResults.setProject(UNKNOWN); scanResults.setScanType(SCAN_TYPE); + + return scanResults; } diff --git a/src/main/java/com/checkmarx/flow/service/BugTrackerEventTrigger.java b/src/main/java/com/checkmarx/flow/service/BugTrackerEventTrigger.java index 200c8ae72..b53babc7f 100644 --- a/src/main/java/com/checkmarx/flow/service/BugTrackerEventTrigger.java +++ b/src/main/java/com/checkmarx/flow/service/BugTrackerEventTrigger.java @@ -51,8 +51,8 @@ public BugTracker.Type triggerScanStartedEvent(ScanRequest request) { case GITHUBPULL: if (gitService.isScanSubmittedComment() && request.getScanSubmittedComment()) { gitService.sendMergeComment(request, SCAN_MESSAGE,gitService.isCommentUpdate()); + gitService.startBlockMerge(request, cxProperties.getUrl()); } - gitService.startBlockMerge(request, cxProperties.getUrl()); break; case BITBUCKETPULL: diff --git a/src/main/java/com/checkmarx/flow/service/FlowService.java b/src/main/java/com/checkmarx/flow/service/FlowService.java index 54c7ecf8d..c48088672 100644 --- a/src/main/java/com/checkmarx/flow/service/FlowService.java +++ b/src/main/java/com/checkmarx/flow/service/FlowService.java @@ -70,6 +70,8 @@ private void runScanRequest(ScanRequest scanRequest, List resultsService.publishCombinedResults(scanRequest, combinedResults); } + + private List getEnabledScanners(ScanRequest scanRequest) { List enabledScanners = new ArrayList<>(); diff --git a/src/main/java/com/checkmarx/flow/service/GitHubService.java b/src/main/java/com/checkmarx/flow/service/GitHubService.java index 640d8c0d8..f42e14491 100644 --- a/src/main/java/com/checkmarx/flow/service/GitHubService.java +++ b/src/main/java/com/checkmarx/flow/service/GitHubService.java @@ -274,6 +274,7 @@ public void startBlockMerge(ScanRequest request, String url){ log.error(URL_INVALID, e); } } + HttpEntity httpEntity = new HttpEntity<>( getJSONStatus(PULL_REQUEST_STATUS, url, "Checkmarx Scan Initiated").toString(), createAuthHeaders(request)