From 1767caa3d6d6ed207970865d3098b660aefeb082 Mon Sep 17 00:00:00 2001 From: itsKedar <37594766+itsKedar@users.noreply.github.com> Date: Fri, 26 Jul 2024 12:10:35 +0530 Subject: [PATCH] Removed codeBashing Training Links (#1362) --- .../checkmarx/flow/service/IssueService.java | 8 ++++---- .../checkmarx/flow/service/JiraService.java | 20 +++++++++---------- .../com/checkmarx/flow/utils/HTMLHelper.java | 8 ++++---- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/checkmarx/flow/service/IssueService.java b/src/main/java/com/checkmarx/flow/service/IssueService.java index 5e1a9f163..e4d564f5b 100644 --- a/src/main/java/com/checkmarx/flow/service/IssueService.java +++ b/src/main/java/com/checkmarx/flow/service/IssueService.java @@ -29,7 +29,7 @@ public class IssueService implements ApplicationContextAware { private ApplicationContext context; private static final Logger log = org.slf4j.LoggerFactory.getLogger(IssueService.class); private final FlowProperties properties; - private final CodeBashingService codeBashingService; + //private final CodeBashingService codeBashingService; public ApplicationContext getContext() { return context; @@ -42,7 +42,7 @@ public void setApplicationContext(ApplicationContext context){ public IssueService(FlowProperties properties, CodeBashingService codeBashingService) { this.properties = properties; - this.codeBashingService = codeBashingService; + //this.codeBashingService = codeBashingService; } /** @@ -102,7 +102,7 @@ public void process(ScanResults results, ScanRequest request) throws MachinaExce tracker.init(request, results); String fpLabel = tracker.getFalsePositiveLabel(); - codeBashingService.createLessonsMap(); + //codeBashingService.createLessonsMap(); log.info("Processing Issues with custom bean {}", customBean); @@ -119,7 +119,7 @@ public void process(ScanResults results, ScanRequest request) throws MachinaExce String fileUrl; ScanResults.XIssue currentIssue = xIssue.getValue(); - codeBashingService.addCodebashingUrlToIssue(currentIssue); + //codeBashingService.addCodebashingUrlToIssue(currentIssue); /*Issue already exists -> update and comment*/ if (iMap.containsKey(xIssue.getKey())) { diff --git a/src/main/java/com/checkmarx/flow/service/JiraService.java b/src/main/java/com/checkmarx/flow/service/JiraService.java index 83e942149..20005296c 100644 --- a/src/main/java/com/checkmarx/flow/service/JiraService.java +++ b/src/main/java/com/checkmarx/flow/service/JiraService.java @@ -77,7 +77,7 @@ public class JiraService { private final FlowProperties flowProperties; private final String parentUrl; private final String grandParentUrl; - private final CodeBashingService codeBashingService; + //private final CodeBashingService codeBashingService; private final HelperService helperService; //Map used to store/retrieve custom field values private final ConcurrentHashMap> customFields = new ConcurrentHashMap<>(); @@ -98,13 +98,11 @@ public JiraProperties getJiraProperties() { } public JiraService(JiraProperties jiraProperties, FlowProperties flowProperties, - CodeBashingService codeBashingService, HelperService helperService,@Qualifier("SSLRestTemplate") RestTemplate restTemplate) { this.jiraProperties = jiraProperties; this.flowProperties = flowProperties; parentUrl = jiraProperties.getParentUrl(); grandParentUrl = jiraProperties.getGrandParentUrl(); - this.codeBashingService = codeBashingService; this.helperService = helperService; this.restTemplate = restTemplate; } @@ -721,9 +719,9 @@ private void mapCustomFields(ScanRequest request, ScanResults.XIssue issue, Issu if (!ScanUtils.anyEmpty(flowProperties.getMitreUrl(), issue.getCwe())) { recommendation.append("Mitre Details: ").append(String.format(flowProperties.getMitreUrl(), issue.getCwe())).append(HTMLHelper.CRLF); } - if (!ScanUtils.empty(flowProperties.getCodebashUrl())) { - recommendation.append("Training: ").append(issue.getAdditionalDetails().get(FlowConstants.CODE_BASHING_LESSON)).append(HTMLHelper.CRLF); - } +// if (!ScanUtils.empty(flowProperties.getCodebashUrl())) { +// recommendation.append("Training: ").append(issue.getAdditionalDetails().get(FlowConstants.CODE_BASHING_LESSON)).append(HTMLHelper.CRLF); +// } if (!ScanUtils.empty(flowProperties.getWikiUrl())) { recommendation.append("Guidance: ").append(flowProperties.getWikiUrl()).append(HTMLHelper.CRLF); } @@ -1564,9 +1562,9 @@ private String getBody(ScanResults.XIssue issue, ScanRequest request, String fil Map additionalDetails = issue.getAdditionalDetails(); - if (!MapUtils.isEmpty(additionalDetails) && additionalDetails.containsKey(FlowConstants.CODE_BASHING_LESSON)) { - body.append("[Training|").append(additionalDetails.get(FlowConstants.CODE_BASHING_LESSON)).append("]").append(HTMLHelper.CRLF); - } +// if (!MapUtils.isEmpty(additionalDetails) && additionalDetails.containsKey(FlowConstants.CODE_BASHING_LESSON)) { +// body.append("[Training|").append(additionalDetails.get(FlowConstants.CODE_BASHING_LESSON)).append("]").append(HTMLHelper.CRLF); +// } if (!ScanUtils.empty(flowProperties.getWikiUrl())) { body.append("[Guidance|").append(flowProperties.getWikiUrl()).append("]").append(HTMLHelper.CRLF); } @@ -1725,7 +1723,7 @@ Map> process(ScanResults results, ScanRequest request, Scan } } - codeBashingService.createLessonsMap(); + //codeBashingService.createLessonsMap(); getAndModifyRequestApplication(request); String jiraProjectKey = determineJiraProjectKey(request); @@ -1768,7 +1766,7 @@ Map> process(ScanResults results, ScanRequest request, Scan String issueCurrentKey = xIssue.getKey(); try { ScanResults.XIssue currentIssue = xIssue.getValue(); - codeBashingService.addCodebashingUrlToIssue(currentIssue); + //codeBashingService.addCodebashingUrlToIssue(currentIssue); /*Issue already exists -> update and comment*/ if (jiraMap.containsKey(issueCurrentKey)) { diff --git a/src/main/java/com/checkmarx/flow/utils/HTMLHelper.java b/src/main/java/com/checkmarx/flow/utils/HTMLHelper.java index b701993eb..613bf93ae 100644 --- a/src/main/java/com/checkmarx/flow/utils/HTMLHelper.java +++ b/src/main/java/com/checkmarx/flow/utils/HTMLHelper.java @@ -440,10 +440,10 @@ private static void setSASTMDBody(ScanResults.XIssue issue, String branch, Strin } Map additionalDetails = issue.getAdditionalDetails(); - if (!MapUtils.isEmpty(additionalDetails) && additionalDetails.containsKey(FlowConstants.CODE_BASHING_LESSON)) - { - appendAll(body, "[Training](", additionalDetails.get(FlowConstants.CODE_BASHING_LESSON), ")", HTMLHelper.CRLF); - } +// if (!MapUtils.isEmpty(additionalDetails) && additionalDetails.containsKey(FlowConstants.CODE_BASHING_LESSON)) +// { +// appendAll(body, "[Training](", additionalDetails.get(FlowConstants.CODE_BASHING_LESSON), ")", HTMLHelper.CRLF); +// } if (MapUtils.isNotEmpty(additionalDetails) && additionalDetails.containsKey(RECOMMENDED_FIX)) { body.append("[Recommended Fix](").append(additionalDetails.get(ScanUtils.RECOMMENDED_FIX)).append(")")