mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-01-15 08:13:43 +01:00
Issue #730: Add a test for suppression in an Ant task
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,6 +1,7 @@
|
||||
*/target/**
|
||||
# IntelliJ test run side-effects
|
||||
dependency-check-core/data/
|
||||
dependency-check-ant/data/
|
||||
# Intellij project files
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
11
dependency-check-ant/src/test/resources/test-suppression.xml
Normal file
11
dependency-check-ant/src/test/resources/test-suppression.xml
Normal 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>
|
||||
Reference in New Issue
Block a user