@Test public void transformation_of_id_finding_description_severity_and_name_are_done() throws Exception { String converted = createMetaDataWithOneVulnerabilityFound(); SecHubResult result = transformerToTest.transform(createProductResult(converted)); for (SecHubFinding f: result.getFindings()) { assertEquals(ScanType.WEB_SCAN,f.getType()); } AssertSecHubResult.assertSecHubResult(result). hasFindingWithId(1). hasDescription("desc1"). hasSeverity(com.daimler.sechub.commons.model.Severity.MEDIUM). hasName("type1"); }
@Override public SecHubResult transform(ProductResult productResult) throws SecHubExecutionException { String origin = productResult.getResult(); String projectId = productResult.getProjectId(); SerecoMetaData data = JSONConverter.get().fromJSON(SerecoMetaData.class, origin); falsePositiveMarker.markFalsePositives(projectId, data.getVulnerabilities()); SecHubResult result = new SecHubResult(); List<SecHubFinding> findings = result.getFindings(); int findingId = 0; for (SerecoVulnerability v : data.getVulnerabilities()) { findingId++; if (v.isFalsePositive()) { continue; } SecHubFinding finding = new SecHubFinding(); handleClassifications(finding, v, productResult.getSecHubJobUUID()); finding.setDescription(v.getDescription()); finding.setName(v.getType()); finding.setId(findingId); finding.setSeverity(transformSeverity(v.getSeverity())); if (showProductLineResultLink) { finding.setProductResultLink(v.getProductResultLink()); } finding.setCode(convert(v.getCode())); finding.setType(v.getScanType()); findings.add(finding); } return result; }
SerecoReportToSecHubResultTransformer implements ScanReportToSecHubResultTransformer { @Override public SecHubResult transform(ProductResult productResult) throws SecHubExecutionException { String origin = productResult.getResult(); String projectId = productResult.getProjectId(); SerecoMetaData data = JSONConverter.get().fromJSON(SerecoMetaData.class, origin); falsePositiveMarker.markFalsePositives(projectId, data.getVulnerabilities()); SecHubResult result = new SecHubResult(); List<SecHubFinding> findings = result.getFindings(); int findingId = 0; for (SerecoVulnerability v : data.getVulnerabilities()) { findingId++; if (v.isFalsePositive()) { continue; } SecHubFinding finding = new SecHubFinding(); handleClassifications(finding, v, productResult.getSecHubJobUUID()); finding.setDescription(v.getDescription()); finding.setName(v.getType()); finding.setId(findingId); finding.setSeverity(transformSeverity(v.getSeverity())); if (showProductLineResultLink) { finding.setProductResultLink(v.getProductResultLink()); } finding.setCode(convert(v.getCode())); finding.setType(v.getScanType()); findings.add(finding); } return result; } }
SerecoReportToSecHubResultTransformer implements ScanReportToSecHubResultTransformer { @Override public SecHubResult transform(ProductResult productResult) throws SecHubExecutionException { String origin = productResult.getResult(); String projectId = productResult.getProjectId(); SerecoMetaData data = JSONConverter.get().fromJSON(SerecoMetaData.class, origin); falsePositiveMarker.markFalsePositives(projectId, data.getVulnerabilities()); SecHubResult result = new SecHubResult(); List<SecHubFinding> findings = result.getFindings(); int findingId = 0; for (SerecoVulnerability v : data.getVulnerabilities()) { findingId++; if (v.isFalsePositive()) { continue; } SecHubFinding finding = new SecHubFinding(); handleClassifications(finding, v, productResult.getSecHubJobUUID()); finding.setDescription(v.getDescription()); finding.setName(v.getType()); finding.setId(findingId); finding.setSeverity(transformSeverity(v.getSeverity())); if (showProductLineResultLink) { finding.setProductResultLink(v.getProductResultLink()); } finding.setCode(convert(v.getCode())); finding.setType(v.getScanType()); findings.add(finding); } return result; }  }
SerecoReportToSecHubResultTransformer implements ScanReportToSecHubResultTransformer { @Override public SecHubResult transform(ProductResult productResult) throws SecHubExecutionException { String origin = productResult.getResult(); String projectId = productResult.getProjectId(); SerecoMetaData data = JSONConverter.get().fromJSON(SerecoMetaData.class, origin); falsePositiveMarker.markFalsePositives(projectId, data.getVulnerabilities()); SecHubResult result = new SecHubResult(); List<SecHubFinding> findings = result.getFindings(); int findingId = 0; for (SerecoVulnerability v : data.getVulnerabilities()) { findingId++; if (v.isFalsePositive()) { continue; } SecHubFinding finding = new SecHubFinding(); handleClassifications(finding, v, productResult.getSecHubJobUUID()); finding.setDescription(v.getDescription()); finding.setName(v.getType()); finding.setId(findingId); finding.setSeverity(transformSeverity(v.getSeverity())); if (showProductLineResultLink) { finding.setProductResultLink(v.getProductResultLink()); } finding.setCode(convert(v.getCode())); finding.setType(v.getScanType()); findings.add(finding); } return result; }  @Override SecHubResult transform(ProductResult productResult); @Override boolean canTransform(ProductIdentifier productIdentifier); }
SerecoReportToSecHubResultTransformer implements ScanReportToSecHubResultTransformer { @Override public SecHubResult transform(ProductResult productResult) throws SecHubExecutionException { String origin = productResult.getResult(); String projectId = productResult.getProjectId(); SerecoMetaData data = JSONConverter.get().fromJSON(SerecoMetaData.class, origin); falsePositiveMarker.markFalsePositives(projectId, data.getVulnerabilities()); SecHubResult result = new SecHubResult(); List<SecHubFinding> findings = result.getFindings(); int findingId = 0; for (SerecoVulnerability v : data.getVulnerabilities()) { findingId++; if (v.isFalsePositive()) { continue; } SecHubFinding finding = new SecHubFinding(); handleClassifications(finding, v, productResult.getSecHubJobUUID()); finding.setDescription(v.getDescription()); finding.setName(v.getType()); finding.setId(findingId); finding.setSeverity(transformSeverity(v.getSeverity())); if (showProductLineResultLink) { finding.setProductResultLink(v.getProductResultLink()); } finding.setCode(convert(v.getCode())); finding.setType(v.getScanType()); findings.add(finding); } return result; }  @Override SecHubResult transform(ProductResult productResult); @Override boolean canTransform(ProductIdentifier productIdentifier);  }