use of com.checkmarx.sdk.dto.sca.SCAResults in project cx-flow by checkmarx-ltd.
the class CxXMLIssueTracker method marshalScaResults.
private void marshalScaResults(ScanRequest request, ScanResults results) throws IOException {
SCAResults scaResults = results.getScaResults();
if (scaResults != null) {
String filenameFormat = "SCA-Risk-Report" + properties.getFileNameFormat();
createFile(request, filenameFormat);
if (!ScanUtils.empty(scaResults.getOutput())) {
Files.write(Paths.get(new File(request.getFilename()).getCanonicalPath()), scaResults.getOutput().getBytes());
}
}
}
use of com.checkmarx.sdk.dto.sca.SCAResults in project cx-flow by checkmarx-ltd.
the class ScaThresholdsSteps method getFakeSCAResults.
private SCAResults getFakeSCAResults(String findingsName) {
SCAResults scaResults = new SCAResults();
scaResults.setScanId("1");
Summary summary = new Summary();
Map<Filter.Severity, Integer> summaryMap = new EnumMap<>(Filter.Severity.class);
List<Finding> findings = new LinkedList<>();
Map<String, String> specMap = findingsDefs.stream().filter(findingsDef -> findingsDef.get("name").equals(findingsName)).findAny().get();
EnumSet.allOf(Severity.class).forEach(severity -> {
String spec = specMap.get(severity.name().toLowerCase());
log.info("{}-spec: {}", severity, spec);
/* create findings */
Integer count = Arrays.stream(spec.split("-than-")).mapToInt(v -> "more".equals(v) ? 3 : "less".equals(v) ? -3 : Integer.parseInt(v)).reduce(0, Integer::sum);
log.info("going to generate {} issues with {} severity", count, severity);
summaryMap.put(Filter.Severity.valueOf(severity.name()), count);
populateFindings(findings, severity, count);
});
summary.setFindingCounts(summaryMap);
scaResults.setFindings(findings);
scaResults.setSummary(summary);
return scaResults;
}
use of com.checkmarx.sdk.dto.sca.SCAResults in project cx-flow by checkmarx-ltd.
the class GetResultsAnalyticsTestSteps method createFakeSCAScanResults.
private static ScanResults createFakeSCAScanResults(int high, int medium, int low) {
Map<Filter.Severity, Integer> findingCounts = new HashMap<Filter.Severity, Integer>();
SCAResults scaResults = new SCAResults();
scaResults.setScanId("" + SCAN_ID);
List<Finding> findings = new LinkedList<>();
addFinding(high, findingCounts, findings, Severity.HIGH, Filter.Severity.HIGH);
addFinding(medium, findingCounts, findings, Severity.MEDIUM, Filter.Severity.MEDIUM);
addFinding(low, findingCounts, findings, Severity.LOW, Filter.Severity.LOW);
Summary summary = new Summary();
summary.setFindingCounts(findingCounts);
scaResults.setFindings(findings);
scaResults.setSummary(summary);
scaResults.setPackages(new LinkedList<>());
return ScanResults.builder().scaResults(scaResults).xIssues(new ArrayList<>()).build();
}
use of com.checkmarx.sdk.dto.sca.SCAResults in project checkmarx-spring-boot-java-sdk by checkmarx-ltd.
the class AstScanner method toResults.
/**
* Convert Common Client representation of AST results into an object from this SDK.
*/
@Override
protected AstScaResults toResults(ResultsBase scanResults) {
ASTResults astResults = (ASTResults) scanResults;
validateNotNull(astResults);
return new AstScaResults(new SCAResults(), astResults);
}
Aggregations