Changes linked ADO False positive processing
@@ -19,6 +19,7 @@ import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.util.*;
+import java.util.stream.Collectors;
@Service("Azure")
public class ADOIssueTracker implements IssueTracker {
@@ -398,20 +399,32 @@ public class ADOIssueTracker implements IssueTracker {
body.append("<div><a href=\'").append(issue.getLink()).append("\'>Checkmarx</a></div>");
}
if(issue.getDetails() != null && !issue.getDetails().isEmpty()) {
+ Map<Integer, ScanResults.IssueDetails> trueIssues = issue.getDetails().entrySet().stream()
+ .filter(x -> x.getKey( ) != null && x.getValue() != null && !x.getValue().isFalsePositive())
+ .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
+ Map<Integer, ScanResults.IssueDetails> fpIssues = issue.getDetails().entrySet().stream()
+ .filter(x -> x.getKey( ) != null && x.getValue() != null && x.getValue().isFalsePositive())
+ .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
+ if(!trueIssues.isEmpty()) {
body.append("<div><b>Lines: </b>");
- for (Map.Entry<Integer, String> entry : issue.getDetails().entrySet()) {
- if (entry.getKey() != null) { //[<line>](<url>)
+ for (Map.Entry<Integer, ScanResults.IssueDetails> entry : trueIssues.entrySet()) {
body.append(entry.getKey()).append(" ");
}
+ body.append("</div>");
+ }
+ if(flowProperties.isListFalsePositives() && !fpIssues.isEmpty()) {//List the false positives / not exploitable
+ body.append("<div><b>Lines Marked Not Exploitable: </b>");
+ for (Map.Entry<Integer, ScanResults.IssueDetails> entry : fpIssues.entrySet()) {
+ body.append(entry.getKey()).append(" ");
}
body.append("</div>");
-
- for (Map.Entry<Integer, String> entry : issue.getDetails().entrySet()) {
- if (entry.getKey() != null && entry.getValue() != null) {
+ }
+ for (Map.Entry<Integer, ScanResults.IssueDetails> entry : trueIssues.entrySet()) {
+ if (!ScanUtils.empty(entry.getValue().getCodeSnippet())) {
body.append("<hr/>");
body.append("<b>Line #").append(entry.getKey()).append("</b>");
body.append("<pre><code><div>");
- body.append(entry.getValue());
+ body.append(entry.getValue().getCodeSnippet());
body.append("</div></code></pre><div>");
}
}
