From be1ccdfb7f7d143c651c39a14b25699e04742022 Mon Sep 17 00:00:00 2001 From: itsKedar <37594766+itsKedar@users.noreply.github.com> Date: Tue, 30 Jul 2024 13:36:33 +0530 Subject: [PATCH] Fixed Jira not closing issues marked Not Exploitable in SAST (#1377) --- .../checkmarx/flow/service/JiraService.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/main/java/com/checkmarx/flow/service/JiraService.java b/src/main/java/com/checkmarx/flow/service/JiraService.java index 20005296c..d3e022a35 100644 --- a/src/main/java/com/checkmarx/flow/service/JiraService.java +++ b/src/main/java/com/checkmarx/flow/service/JiraService.java @@ -1798,6 +1798,27 @@ Map> process(ScanResults results, ScanRequest request, Scan log.debug("Issue: {} successfully updated. Removing it from dynamic scan results map", xIssue.getValue()); nonPublishedScanResultsMap.remove(issueCurrentKey); } + /* check if false positive exist in unFilteredMap as in filtered map we won't get data for filters like filter-state/filter-category/filter-status/filter-cwe */ + for (Map.Entry xIssue : unFilteredMap.entrySet()) { + String issueCurrentKey = xIssue.getKey(); + try{ + ScanResults.XIssue currentIssue = xIssue.getValue(); + if (jiraMap.containsKey(issueCurrentKey)) { + Issue issue = jiraMap.get(issueCurrentKey); + if (xIssue.getValue().isAllFalsePositive()) { + //All issues are false positive, so issue should be closed + log.debug("{} issue are false positives",issueCurrentKey); + Issue fpIssue; + fpIssue = checkForFalsePositiveIssuesInList(request, xIssue, currentIssue, issue); + closeIssueInCaseOfIssueIsInOpenState(request, closedIssues, fpIssue); + } + } + + }catch (RestClientException e){ + log.error("Error occurred while processing issue with key {}", issueCurrentKey, e); + throw new JiraClientException(); + } + } /*Check if an issue exists in Jira but not within results and close if not*/ closeIssueInCaseNotWithinResults(request, unFilteredMap, jiraMap, closedIssues);