Issue #730: Add a test for suppression in an Ant task

This commit is contained in:
Phillip Whittlesea
2017-06-11 16:06:32 +01:00
parent 76218da8d1
commit ed214d05fa
4 changed files with 44 additions and 5 deletions

1
.gitignore vendored
View File

@@ -1,6 +1,7 @@
*/target/**
# IntelliJ test run side-effects
dependency-check-core/data/
dependency-check-ant/data/
# Intellij project files
*.iml
*.ipr

View File

@@ -114,4 +114,18 @@ public class DependencyCheckTaskTest {
expectedException.expect(BuildException.class);
buildFileRule.executeTarget("failCVSS");
}
/**
* Test the DependencyCheckTask where a CVE is suppressed.
*/
@Test
public void testSuppressingCVE() {
// GIVEN an ant task with a vulnerability
final String antTaskName = "suppression";
// WHEN executing the ant task
buildFileRule.executeTarget(antTaskName);
// THEN the ant task executed without error
}
}

View File

@@ -61,11 +61,24 @@
<target name="failCVSS">
<dependency-check
applicationName="test failCVSS"
reportOutputDirectory="${project.build.directory}"
reportFormat="XML"
autoupdate="false"
failBuildOnCVSS="3">
applicationName="test failCVSS"
reportOutputDirectory="${project.build.directory}"
reportFormat="XML"
autoupdate="false"
failBuildOnCVSS="3">
<fileset dir="${project.build.directory}/test-classes/jars">
<include name="axis-1.4.jar"/>
</fileset>
</dependency-check>
</target>
<target name="suppression">
<dependency-check
applicationName="test suppression"
reportOutputDirectory="${project.build.directory}"
autoupdate="false"
failBuildOnCVSS="3"
suppressionFile="${project.build.directory}/test-classes/test-suppression.xml">
<fileset dir="${project.build.directory}/test-classes/jars">
<include name="axis-1.4.jar"/>
</fileset>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Test suppression file for the DependencyCheckTaskTest#testSuppressingCVE() test -->
<suppressions xmlns="https://jeremylong.github.io/DependencyCheck/dependency-suppression.1.1.xsd">
<suppress>
<notes><![CDATA[
file name: axis-1.4.jar
]]></notes>
<gav regex="true">^org\.apache\.axis:axis:.*$</gav>
<cpe>cpe:/a:apache:axis</cpe>
</suppress>
</suppressions>