use of com.mercedesbenz.sechub.domain.scan.project.FalsePositiveMetaData in project sechub by mercedes-benz.
the class SerecoFalsePositiveFinderTest method web_scan_triggers_webscan_strategy_and_uses_its_result.
@Test
public void web_scan_triggers_webscan_strategy_and_uses_its_result() {
/* prepare */
/* @formatter:off */
SerecoVulnerability vulnerability = TestSerecoVulnerabilityBuilder.builder().name("name1").webScan().end().build();
/* @formatter:on */
FalsePositiveMetaData metaData = fetchFirstEntryMetaDataOfExample3();
when(webScanStrategy.isFalsePositive(vulnerability, metaData)).thenReturn(yesItIsAFalsePositive);
/* execute */
boolean strategyResult = finderToTest.isFound(vulnerability, metaData);
/* test */
verify(webScanStrategy).isFalsePositive(vulnerability, metaData);
assertEquals(yesItIsAFalsePositive, strategyResult);
// additional check that other strategy is not called here
verify(codeScanStrategy, never()).isFalsePositive(vulnerability, metaData);
}
use of com.mercedesbenz.sechub.domain.scan.project.FalsePositiveMetaData in project sechub by mercedes-benz.
the class SerecoFalsePositiveFinderTest method infrascan_triggers_not_codescanstrategy.
@Test
public void infrascan_triggers_not_codescanstrategy() {
/* prepare */
/* @formatter:off */
SerecoVulnerability vulnerability = TestSerecoVulnerabilityBuilder.builder().name("name1").infraScan().end().build();
/* @formatter:on */
FalsePositiveMetaData metaData = fetchFirstEntryMetaDataOfExample3();
/* execute */
finderToTest.isFound(vulnerability, metaData);
/* test */
verify(codeScanStrategy, never()).isFalsePositive(vulnerability, metaData);
}
use of com.mercedesbenz.sechub.domain.scan.project.FalsePositiveMetaData in project sechub by mercedes-benz.
the class SerecoFalsePositiveFinderTest method fetchFirstEntryMetaDataOfExample3.
private FalsePositiveMetaData fetchFirstEntryMetaDataOfExample3() {
String json = ScanProductSerecoTestFileSupport.getTestfileSupport().loadTestFile("false_positives/scan_false_positive_config_example3.json");
FalsePositiveProjectConfiguration config = FalsePositiveProjectConfiguration.fromJSONString(json);
FalsePositiveEntry entry = config.getFalsePositives().get(0);
// sanity check, means correct entry...
assertEquals("entry-1", entry.getJobData().getComment());
FalsePositiveMetaData metaData = entry.getMetaData();
return metaData;
}
use of com.mercedesbenz.sechub.domain.scan.project.FalsePositiveMetaData in project sechub by mercedes-benz.
the class SerecoFalsePositiveMarkerTest method a_codescan_triggers_NOT_falsePositiveFinder_for_fp_setting_for_webscan.
@Test
public void a_codescan_triggers_NOT_falsePositiveFinder_for_fp_setting_for_webscan() {
/* prepare */
FalsePositiveMetaData metaData = addEntryAndReturnMetaData(projectConfig, ScanType.WEB_SCAN);
config.setData(projectConfig.toJSON());
List<SerecoVulnerability> all = new ArrayList<>();
SerecoVulnerability v1 = addVulnerability(all, ScanType.CODE_SCAN);
/* execute */
markerToTest.markFalsePositives(PROJECT_ID, all);
/* test */
verify(falsePositiveFinder, never()).isFound(v1, metaData);
}
use of com.mercedesbenz.sechub.domain.scan.project.FalsePositiveMetaData in project sechub by mercedes-benz.
the class SerecoFalsePositiveMarkerTest method addEntryAndReturnMetaData.
private FalsePositiveMetaData addEntryAndReturnMetaData(FalsePositiveProjectConfiguration projectConfig, ScanType scanType) {
List<FalsePositiveEntry> fp = projectConfig.getFalsePositives();
FalsePositiveEntry e = new FalsePositiveEntry();
FalsePositiveMetaData metaData = new FalsePositiveMetaData();
metaData.setScanType(scanType);
e.setMetaData(metaData);
fp.add(e);
return metaData;
}
Aggregations