Skip to content

Commit

Permalink
feat: add HTML report without JS (#5053)
Browse files Browse the repository at this point in the history
* feat: add HTML report without JS, resolves #5039

* fix(javadoc): Update ant/src/main/java/org/owasp/dependencycheck/taskdefs/Check.java
  • Loading branch information
jeremylong committed Nov 19, 2022
1 parent 3090b06 commit aef859b
Show file tree
Hide file tree
Showing 5 changed files with 811 additions and 6 deletions.
Expand Up @@ -229,12 +229,12 @@ public class Check extends Update {
*/
private Boolean autoUpdate;
/**
* The report format to be generated (HTML, XML, JUNIT, CSV, JSON, SARIF,
* The report format to be generated (HTML, XML, JUNIT, CSV, JSON, SARIF, JENKINS,
* ALL). Default is HTML.
*/
private String reportFormat = "HTML";
/**
* The report format to be generated (HTML, XML, JUNIT, CSV, JSON, SARIF,
* The report format to be generated (HTML, XML, JUNIT, CSV, JSON, SARIF, JENKINS,
* ALL). Default is HTML.
*/
private final List<String> reportFormats = new ArrayList<>();
Expand Down Expand Up @@ -2111,7 +2111,7 @@ private void checkForFailure(Dependency[] dependencies) throws BuildException {

/**
* An enumeration of supported report formats: "ALL", "HTML", "XML", "CSV",
* "JSON", "JUNIT", "SARIF", etc..
* "JSON", "JUNIT", "SARIF", 'JENkINS', etc..
*/
public static class ReportFormats extends EnumeratedAttribute {

Expand Down
2 changes: 1 addition & 1 deletion cli/src/main/java/org/owasp/dependencycheck/CliParser.java
Expand Up @@ -64,7 +64,7 @@ public final class CliParser {
/**
* The supported reported formats.
*/
private static final String SUPPORTED_FORMATS = "HTML, XML, CSV, JSON, JUNIT, SARIF, or ALL";
private static final String SUPPORTED_FORMATS = "HTML, XML, CSV, JSON, JUNIT, SARIF, JENKINS, or ALL";

/**
* Constructs a new CLI Parser object with the configured settings.
Expand Down
Expand Up @@ -116,6 +116,10 @@ public enum Format {
* Generate Sarif report.
*/
SARIF,
/**
* Generate HTML report without script or non-vulnerable libraries for Jenkins.
*/
JENKINS,
/**
* Generate JUNIT report.
*/
Expand Down Expand Up @@ -373,6 +377,9 @@ public static File getReportFile(String outputLocation, Format format) {
if (format == Format.HTML && !pathToCheck.endsWith(".html") && !pathToCheck.endsWith(".htm")) {
return new File(outFile, "dependency-check-report.html");
}
if (format == Format.JENKINS && !pathToCheck.endsWith(".html") && !pathToCheck.endsWith(".htm")) {
return new File(outFile, "dependency-check-jenkins.html");
}
if (format == Format.JSON && !pathToCheck.endsWith(".json")) {
return new File(outFile, "dependency-check-report.json");
}
Expand Down

0 comments on commit aef859b

Please sign in to comment.