Skip to content

Commit

Permalink
Removed codeBashing Training Links (#1362)
Browse files Browse the repository at this point in the history
  • Loading branch information
itsKedar authored Jul 26, 2024
1 parent fd72dbc commit 1767caa
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
8 changes: 4 additions & 4 deletions src/main/java/com/checkmarx/flow/service/IssueService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -42,7 +42,7 @@ public void setApplicationContext(ApplicationContext context){

public IssueService(FlowProperties properties, CodeBashingService codeBashingService) {
this.properties = properties;
this.codeBashingService = codeBashingService;
//this.codeBashingService = codeBashingService;
}

/**
Expand Down Expand Up @@ -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);

Expand All @@ -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())) {
Expand Down
20 changes: 9 additions & 11 deletions src/main/java/com/checkmarx/flow/service/JiraService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, Map<String, String>> customFields = new ConcurrentHashMap<>();
Expand All @@ -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;
}
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -1564,9 +1562,9 @@ private String getBody(ScanResults.XIssue issue, ScanRequest request, String fil

Map<String, Object> 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);
}
Expand Down Expand Up @@ -1725,7 +1723,7 @@ Map<String, List<String>> process(ScanResults results, ScanRequest request, Scan
}
}

codeBashingService.createLessonsMap();
//codeBashingService.createLessonsMap();
getAndModifyRequestApplication(request);

String jiraProjectKey = determineJiraProjectKey(request);
Expand Down Expand Up @@ -1768,7 +1766,7 @@ Map<String, List<String>> 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)) {
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/com/checkmarx/flow/utils/HTMLHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -440,10 +440,10 @@ private static void setSASTMDBody(ScanResults.XIssue issue, String branch, Strin
}

Map<String, Object> 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(")")
Expand Down

0 comments on commit 1767caa

Please sign in to comment.