diff --git a/dependency-check-ant/src/main/java/org/owasp/dependencycheck/taskdefs/Check.java b/dependency-check-ant/src/main/java/org/owasp/dependencycheck/taskdefs/Check.java
index cfefeb27c..78f6e823a 100644
--- a/dependency-check-ant/src/main/java/org/owasp/dependencycheck/taskdefs/Check.java
+++ b/dependency-check-ant/src/main/java/org/owasp/dependencycheck/taskdefs/Check.java
@@ -86,8 +86,8 @@ public class Check extends Update {
}
/**
- * Returns the path. If the path has not been initialized yet, this class is synchronized, and will instantiate the path
- * object.
+ * Returns the path. If the path has not been initialized yet, this class is
+ * synchronized, and will instantiate the path object.
*
* @return the path
*/
@@ -109,7 +109,8 @@ public class Check extends Update {
}
/**
- * Add a reference to a Path, FileSet, DirSet, or FileList defined elsewhere.
+ * Add a reference to a Path, FileSet, DirSet, or FileList defined
+ * elsewhere.
*
* @param r the reference to a path, fileset, dirset or filelist.
*/
@@ -121,7 +122,8 @@ public class Check extends Update {
}
/**
- * If this is a reference, this method will add the referenced resource collection to the collection of paths.
+ * If this is a reference, this method will add the referenced resource
+ * collection to the collection of paths.
*
* @throws BuildException if the reference is not to a resource collection
*/
@@ -196,7 +198,8 @@ public class Check extends Update {
}
/**
- * Specifies the destination directory for the generated Dependency-Check report.
+ * Specifies the destination directory for the generated Dependency-Check
+ * report.
*/
private String reportOutputDirectory = ".";
@@ -218,9 +221,11 @@ public class Check extends Update {
this.reportOutputDirectory = reportOutputDirectory;
}
/**
- * Specifies if the build should be failed if a CVSS score above a specified level is identified. The default is 11 which
- * means since the CVSS scores are 0-10, by default the build will never fail and the CVSS score is set to 11. The valid range
- * for the fail build on CVSS is 0 to 11, where anything above 10 will not cause the build to fail.
+ * Specifies if the build should be failed if a CVSS score above a specified
+ * level is identified. The default is 11 which means since the CVSS scores
+ * are 0-10, by default the build will never fail and the CVSS score is set
+ * to 11. The valid range for the fail build on CVSS is 0 to 11, where
+ * anything above 10 will not cause the build to fail.
*/
private float failBuildOnCVSS = 11;
@@ -242,8 +247,8 @@ public class Check extends Update {
this.failBuildOnCVSS = failBuildOnCVSS;
}
/**
- * Sets whether auto-updating of the NVD CVE/CPE data is enabled. It is not recommended that this be turned to false. Default
- * is true.
+ * Sets whether auto-updating of the NVD CVE/CPE data is enabled. It is not
+ * recommended that this be turned to false. Default is true.
*/
private Boolean autoUpdate;
@@ -295,7 +300,8 @@ public class Check extends Update {
}
/**
- * The report format to be generated (HTML, XML, VULN, ALL). Default is HTML.
+ * The report format to be generated (HTML, XML, VULN, ALL). Default is
+ * HTML.
*/
private String reportFormat = "HTML";
@@ -361,6 +367,29 @@ public class Check extends Update {
this.showSummary = showSummary;
}
+ /**
+ * Whether experimental analyzers are enabled.
+ */
+ private Boolean enableExperimental;
+
+ /**
+ * Get the value of enableExperimental.
+ *
+ * @return the value of enableExperimental
+ */
+ public Boolean isEnableExperimental() {
+ return enableExperimental;
+ }
+
+ /**
+ * Set the value of enableExperimental.
+ *
+ * @param enableExperimental new value of enableExperimental
+ */
+ public void setEnableExperimental(Boolean enableExperimental) {
+ this.enableExperimental = enableExperimental;
+ }
+
/**
* Whether or not the Jar Analyzer is enabled.
*/
@@ -621,7 +650,8 @@ public class Check extends Update {
/**
* Set the value of pyDistributionAnalyzerEnabled.
*
- * @param pyDistributionAnalyzerEnabled new value of pyDistributionAnalyzerEnabled
+ * @param pyDistributionAnalyzerEnabled new value of
+ * pyDistributionAnalyzerEnabled
*/
public void setPyDistributionAnalyzerEnabled(Boolean pyDistributionAnalyzerEnabled) {
this.pyDistributionAnalyzerEnabled = pyDistributionAnalyzerEnabled;
@@ -674,7 +704,8 @@ public class Check extends Update {
}
/**
- * The URL of a Nexus server's REST API end point (http://domain/nexus/service/local).
+ * The URL of a Nexus server's REST API end point
+ * (http://domain/nexus/service/local).
*/
private String nexusUrl;
@@ -719,8 +750,8 @@ public class Check extends Update {
}
/**
- * Additional ZIP File extensions to add analyze. This should be a comma-separated list of file extensions to treat like ZIP
- * files.
+ * Additional ZIP File extensions to add analyze. This should be a
+ * comma-separated list of file extensions to treat like ZIP files.
*/
private String zipExtensions;
@@ -830,7 +861,8 @@ public class Check extends Update {
}
/**
- * Validate the configuration to ensure the parameters have been properly configured/initialized.
+ * Validate the configuration to ensure the parameters have been properly
+ * configured/initialized.
*
* @throws BuildException if the task was not configured correctly.
*/
@@ -844,8 +876,9 @@ public class Check extends Update {
}
/**
- * Takes the properties supplied and updates the dependency-check settings. Additionally, this sets the system properties
- * required to change the proxy server, port, and connection timeout.
+ * Takes the properties supplied and updates the dependency-check settings.
+ * Additionally, this sets the system properties required to change the
+ * proxy server, port, and connection timeout.
*
* @throws BuildException thrown when an invalid setting is configured.
*/
@@ -854,6 +887,7 @@ public class Check extends Update {
super.populateSettings();
Settings.setBooleanIfNotNull(Settings.KEYS.AUTO_UPDATE, autoUpdate);
Settings.setStringIfNotEmpty(Settings.KEYS.SUPPRESSION_FILE, suppressionFile);
+ Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_EXPERIMENTAL_ENABLED, enableExperimental);
Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_JAR_ENABLED, jarAnalyzerEnabled);
Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_PYTHON_DISTRIBUTION_ENABLED, pyDistributionAnalyzerEnabled);
Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_PYTHON_PACKAGE_ENABLED, pyPackageAnalyzerEnabled);
@@ -875,11 +909,12 @@ public class Check extends Update {
}
/**
- * Checks to see if a vulnerability has been identified with a CVSS score that is above the threshold set in the
- * configuration.
+ * Checks to see if a vulnerability has been identified with a CVSS score
+ * that is above the threshold set in the configuration.
*
* @param dependencies the list of dependency objects
- * @throws BuildException thrown if a CVSS score is found that is higher then the threshold set
+ * @throws BuildException thrown if a CVSS score is found that is higher
+ * then the threshold set
*/
private void checkForFailure(List
- * Reads the manifest from the JAR file and collects the entries. Some vendorKey entries are:true if auto-update is allowed; otherwise false
+ * @return true if auto-update is allowed; otherwise
+ * false
*/
public boolean isAutoUpdate() {
return line != null && !line.hasOption(ARGUMENT.DISABLE_AUTO_UPDATE);
@@ -945,7 +985,8 @@ public final class CliParser {
/**
* Checks if the update only flag has been set.
*
- * @return true if the update only flag has been set; otherwise false.
+ * @return true if the update only flag has been set; otherwise
+ * false.
*/
public boolean isUpdateOnly() {
return line != null && line.hasOption(ARGUMENT.UPDATE_ONLY);
@@ -954,14 +995,16 @@ public final class CliParser {
/**
* Checks if the purge NVD flag has been set.
*
- * @return true if the purge nvd flag has been set; otherwise false.
+ * @return true if the purge nvd flag has been set; otherwise
+ * false.
*/
public boolean isPurge() {
return line != null && line.hasOption(ARGUMENT.PURGE_NVD);
}
/**
- * Returns the database driver name if specified; otherwise null is returned.
+ * Returns the database driver name if specified; otherwise null is
+ * returned.
*
* @return the database driver name if specified; otherwise null is returned
*/
@@ -970,7 +1013,8 @@ public final class CliParser {
}
/**
- * Returns the database driver path if specified; otherwise null is returned.
+ * Returns the database driver path if specified; otherwise null is
+ * returned.
*
* @return the database driver name if specified; otherwise null is returned
*/
@@ -979,34 +1023,41 @@ public final class CliParser {
}
/**
- * Returns the database connection string if specified; otherwise null is returned.
+ * Returns the database connection string if specified; otherwise null is
+ * returned.
*
- * @return the database connection string if specified; otherwise null is returned
+ * @return the database connection string if specified; otherwise null is
+ * returned
*/
public String getConnectionString() {
return line.getOptionValue(ARGUMENT.CONNECTION_STRING);
}
/**
- * Returns the database database user name if specified; otherwise null is returned.
+ * Returns the database database user name if specified; otherwise null is
+ * returned.
*
- * @return the database database user name if specified; otherwise null is returned
+ * @return the database database user name if specified; otherwise null is
+ * returned
*/
public String getDatabaseUser() {
return line.getOptionValue(ARGUMENT.DB_NAME);
}
/**
- * Returns the database database password if specified; otherwise null is returned.
+ * Returns the database database password if specified; otherwise null is
+ * returned.
*
- * @return the database database password if specified; otherwise null is returned
+ * @return the database database password if specified; otherwise null is
+ * returned
*/
public String getDatabasePassword() {
return line.getOptionValue(ARGUMENT.DB_PASSWORD);
}
/**
- * Returns the additional Extensions if specified; otherwise null is returned.
+ * Returns the additional Extensions if specified; otherwise null is
+ * returned.
*
* @return the additional Extensions; otherwise null is returned
*/
@@ -1028,7 +1079,17 @@ public final class CliParser {
}
/**
- * A collection of static final strings that represent the possible command line arguments.
+ * Returns true if the experimental analyzers are enabled.
+ *
+ * @return true if the experimental analyzers are enabled; otherwise false
+ */
+ public boolean isExperimentalEnabled() {
+ return line.hasOption(ARGUMENT.EXPERIMENTAL);
+ }
+
+ /**
+ * A collection of static final strings that represent the possible command
+ * line arguments.
*/
public static class ARGUMENT {
@@ -1041,50 +1102,61 @@ public final class CliParser {
*/
public static final String SCAN_SHORT = "s";
/**
- * The long CLI argument name specifying that the CPE/CVE/etc. data should not be automatically updated.
+ * The long CLI argument name specifying that the CPE/CVE/etc. data
+ * should not be automatically updated.
*/
public static final String DISABLE_AUTO_UPDATE = "noupdate";
/**
- * The short CLI argument name specifying that the CPE/CVE/etc. data should not be automatically updated.
+ * The short CLI argument name specifying that the CPE/CVE/etc. data
+ * should not be automatically updated.
*/
public static final String DISABLE_AUTO_UPDATE_SHORT = "n";
/**
- * The long CLI argument name specifying that only the update phase should be executed; no scan should be run.
+ * The long CLI argument name specifying that only the update phase
+ * should be executed; no scan should be run.
*/
public static final String UPDATE_ONLY = "updateonly";
/**
- * The long CLI argument name specifying that only the update phase should be executed; no scan should be run.
+ * The long CLI argument name specifying that only the update phase
+ * should be executed; no scan should be run.
*/
public static final String PURGE_NVD = "purge";
/**
- * The long CLI argument name specifying the directory to write the reports to.
+ * The long CLI argument name specifying the directory to write the
+ * reports to.
*/
public static final String OUT = "out";
/**
- * The short CLI argument name specifying the directory to write the reports to.
+ * The short CLI argument name specifying the directory to write the
+ * reports to.
*/
public static final String OUT_SHORT = "o";
/**
- * The long CLI argument name specifying the output format to write the reports to.
+ * The long CLI argument name specifying the output format to write the
+ * reports to.
*/
public static final String OUTPUT_FORMAT = "format";
/**
- * The short CLI argument name specifying the output format to write the reports to.
+ * The short CLI argument name specifying the output format to write the
+ * reports to.
*/
public static final String OUTPUT_FORMAT_SHORT = "f";
/**
- * The long CLI argument name specifying the name of the project to be scanned.
+ * The long CLI argument name specifying the name of the project to be
+ * scanned.
*/
public static final String PROJECT = "project";
/**
- * The long CLI argument name specifying the name of the application to be scanned.
+ * The long CLI argument name specifying the name of the application to
+ * be scanned.
*
* @deprecated project should be used instead
*/
@Deprecated
public static final String APP_NAME = "app";
/**
- * The short CLI argument name specifying the name of the application to be scanned.
+ * The short CLI argument name specifying the name of the application to
+ * be scanned.
*
* @deprecated project should be used instead
*/
@@ -1142,11 +1214,13 @@ public final class CliParser {
*/
public static final String CONNECTION_TIMEOUT = "connectiontimeout";
/**
- * The short CLI argument name for setting the location of an additional properties file.
+ * The short CLI argument name for setting the location of an additional
+ * properties file.
*/
public static final String PROP_SHORT = "P";
/**
- * The CLI argument name for setting the location of an additional properties file.
+ * The CLI argument name for setting the location of an additional
+ * properties file.
*/
public static final String PROP = "propertyfile";
/**
@@ -1170,7 +1244,8 @@ public final class CliParser {
*/
public static final String CVE_BASE_20 = "cveUrl20Base";
/**
- * The short CLI argument name for setting the location of the data directory.
+ * The short CLI argument name for setting the location of the data
+ * directory.
*/
public static final String DATA_DIRECTORY_SHORT = "d";
/**
@@ -1178,20 +1253,24 @@ public final class CliParser {
*/
public static final String VERBOSE_LOG = "log";
/**
- * The short CLI argument name for setting the location of the data directory.
+ * The short CLI argument name for setting the location of the data
+ * directory.
*/
public static final String VERBOSE_LOG_SHORT = "l";
/**
- * The CLI argument name for setting the depth of symbolic links that will be followed.
+ * The CLI argument name for setting the depth of symbolic links that
+ * will be followed.
*/
public static final String SYM_LINK_DEPTH = "symLink";
/**
- * The CLI argument name for setting the location of the suppression file.
+ * The CLI argument name for setting the location of the suppression
+ * file.
*/
public static final String SUPPRESSION_FILE = "suppression";
/**
- * The CLI argument name for setting the location of the suppression file.
+ * The CLI argument name for setting the location of the suppression
+ * file.
*/
public static final String CVE_VALID_FOR_HOURS = "cveValidForHours";
/**
@@ -1259,7 +1338,8 @@ public final class CliParser {
*/
public static final String NEXUS_URL = "nexus";
/**
- * Whether or not the defined proxy should be used when connecting to Nexus.
+ * Whether or not the defined proxy should be used when connecting to
+ * Nexus.
*/
public static final String NEXUS_USES_PROXY = "nexusUsesProxy";
/**
@@ -1279,11 +1359,13 @@ public final class CliParser {
*/
public static final String DB_DRIVER = "dbDriverName";
/**
- * The CLI argument name for setting the path to the database driver; in case it is not on the class path.
+ * The CLI argument name for setting the path to the database driver; in
+ * case it is not on the class path.
*/
public static final String DB_DRIVER_PATH = "dbDriverPath";
/**
- * The CLI argument name for setting the path to mono for .NET Assembly analysis on non-windows systems.
+ * The CLI argument name for setting the path to mono for .NET Assembly
+ * analysis on non-windows systems.
*/
public static final String PATH_TO_MONO = "mono";
/**
@@ -1295,8 +1377,13 @@ public final class CliParser {
*/
public static final String EXCLUDE = "exclude";
/**
- * The CLI argument name for setting the path to bundle-audit for Ruby bundle analysis.
+ * The CLI argument name for setting the path to bundle-audit for Ruby
+ * bundle analysis.
*/
public static final String PATH_TO_BUNDLE_AUDIT = "bundleAudit";
+ /**
+ * The CLI argument to enable the experimental analyzers.
+ */
+ private static final String EXPERIMENTAL = "enableExperimental";
}
}
diff --git a/dependency-check-cli/src/site/markdown/arguments.md b/dependency-check-cli/src/site/markdown/arguments.md
index 66f37af01..876eee216 100644
--- a/dependency-check-cli/src/site/markdown/arguments.md
+++ b/dependency-check-cli/src/site/markdown/arguments.md
@@ -18,7 +18,7 @@ Short | Argument Name | Parameter | Description | Requir
| \-\-advancedHelp | | Print the advanced help message. | Optional
\-v | \-\-version | | Print the version information. | Optional
| \-\-cveValidForHours | \
- * Stores information about a given class name. This class will keep the fully qualified class name and a list of the - * important parts of the package structure. Up to the first four levels of the package structure are stored, excluding a - * leading "org" or "com". Example:
+ * Stores information about a given class name. This class will keep the + * fully qualified class name and a list of the important parts of the + * package structure. Up to the first four levels of the package + * structure are stored, excluding a leading "org" or "com". + * Example: *ClassNameInformation obj = new ClassNameInformation("org.owasp.dependencycheck.analyzer.JarAnalyzer");
* System.out.println(obj.getName());
* for (String p : obj.getPackageStructure())
@@ -1169,7 +1202,8 @@ public class JarAnalyzer extends AbstractFileTypeAnalyzer {
this.name = name;
}
/**
- * Up to the first four levels of the package structure, excluding a leading "org" or "com".
+ * Up to the first four levels of the package structure, excluding a
+ * leading "org" or "com".
*/
private final ArrayList packageStructure = new ArrayList();
diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/analyzer/NodePackageAnalyzer.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/analyzer/NodePackageAnalyzer.java
index 85326f392..52b9afe11 100644
--- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/analyzer/NodePackageAnalyzer.java
+++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/analyzer/NodePackageAnalyzer.java
@@ -45,6 +45,7 @@ import javax.json.JsonValue;
*
* @author Dale Visser
*/
+@Experimental
public class NodePackageAnalyzer extends AbstractFileTypeAnalyzer {
/**
diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzer.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzer.java
index 8a315bd42..ea26ce227 100644
--- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzer.java
+++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzer.java
@@ -17,6 +17,16 @@
*/
package org.owasp.dependencycheck.analyzer;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.nio.charset.Charset;
import org.apache.commons.io.FileUtils;
import org.owasp.dependencycheck.Engine;
import org.owasp.dependencycheck.analyzer.exception.AnalysisException;
@@ -29,11 +39,6 @@ import org.owasp.dependencycheck.utils.FileFilterBuilder;
import org.owasp.dependencycheck.utils.Settings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
-import java.io.*;
-import java.nio.charset.Charset;
-import java.util.*;
-import java.util.logging.Level;
import org.owasp.dependencycheck.data.nvdcve.DatabaseException;
/**
@@ -63,9 +68,7 @@ public class RubyBundleAuditAnalyzer extends AbstractFileTypeAnalyzer {
public static final String ADVISORY = "Advisory: ";
public static final String CRITICALITY = "Criticality: ";
- public CveDB cvedb;
- //instance.open();
- //Vulnerability result = instance.getVulnerability("CVE-2015-3225");
+ private CveDB cvedb;
/**
* @return a filter that accepts files named Gemfile.lock
@@ -207,11 +210,10 @@ public class RubyBundleAuditAnalyzer extends AbstractFileTypeAnalyzer {
boolean failed = true;
final String className = RubyGemspecAnalyzer.class.getName();
for (FileTypeAnalyzer analyzer : engine.getFileTypeAnalyzers()) {
- if (analyzer instanceof RubyBundlerAnalyzer) {
+ if (analyzer instanceof RubyBundlerAnalyzer) {
((RubyBundlerAnalyzer) analyzer).setEnabled(false);
LOGGER.info("Disabled " + RubyBundlerAnalyzer.class.getName() + " to avoid noisy duplicate results.");
- }
- else if (analyzer instanceof RubyGemspecAnalyzer) {
+ } else if (analyzer instanceof RubyGemspecAnalyzer) {
((RubyGemspecAnalyzer) analyzer).setEnabled(false);
LOGGER.info("Disabled " + className + " to avoid noisy duplicate results.");
failed = false;
@@ -230,8 +232,9 @@ public class RubyBundleAuditAnalyzer extends AbstractFileTypeAnalyzer {
throw new AnalysisException("bundle-audit process interrupted", ie);
}
BufferedReader rdr = null;
+ BufferedReader errReader = null;
try {
- BufferedReader errReader = new BufferedReader(new InputStreamReader(process.getErrorStream(), "UTF-8"));
+ errReader = new BufferedReader(new InputStreamReader(process.getErrorStream(), "UTF-8"));
while (errReader.ready()) {
String error = errReader.readLine();
LOGGER.warn(error);
@@ -241,6 +244,13 @@ public class RubyBundleAuditAnalyzer extends AbstractFileTypeAnalyzer {
} catch (IOException ioe) {
LOGGER.warn("bundle-audit failure", ioe);
} finally {
+ if (errReader != null) {
+ try {
+ errReader.close();
+ } catch (IOException ioe) {
+ LOGGER.warn("bundle-audit close failure", ioe);
+ }
+ }
if (null != rdr) {
try {
rdr.close();
diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/nvd/DownloadTask.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/nvd/DownloadTask.java
index 1ec66a517..020c2263c 100644
--- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/nvd/DownloadTask.java
+++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/data/update/nvd/DownloadTask.java
@@ -261,6 +261,7 @@ public class DownloadTask implements Callable> {
try {
is.close();
} catch (IOException ex) {
+ LOGGER.debug("Error closing stream", ex);
}
}
}
diff --git a/dependency-check-core/src/main/java/org/owasp/dependencycheck/suppression/SuppressionParser.java b/dependency-check-core/src/main/java/org/owasp/dependencycheck/suppression/SuppressionParser.java
index e4956ed1b..4d368fb3c 100644
--- a/dependency-check-core/src/main/java/org/owasp/dependencycheck/suppression/SuppressionParser.java
+++ b/dependency-check-core/src/main/java/org/owasp/dependencycheck/suppression/SuppressionParser.java
@@ -25,7 +25,6 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.List;
-import java.util.logging.Level;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
@@ -110,7 +109,8 @@ public class SuppressionParser {
*
* @param inputStream an InputStream containing suppression rues
* @return a list of suppression rules
- * @throws SuppressionParseException if the xml cannot be parsed
+ * @throws SuppressionParseException thrown if the xml cannot be parsed
+ * @throws SAXException thrown if the xml cannot be parsed
*/
public List parseSuppressionRules(InputStream inputStream) throws SuppressionParseException, SAXException {
try {
diff --git a/dependency-check-core/src/main/resources/dependencycheck.properties b/dependency-check-core/src/main/resources/dependencycheck.properties
index 118b5b50f..a0a1fd3e7 100644
--- a/dependency-check-core/src/main/resources/dependencycheck.properties
+++ b/dependency-check-core/src/main/resources/dependencycheck.properties
@@ -63,13 +63,6 @@ cve.url-2.0.base=https://nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-%d.xml.gz
cpe.validfordays=30
cpe.url=http://static.nvd.nist.gov/feeds/xml/cpe/dictionary/official-cpe-dictionary_v2.3.xml.gz
-# file type analyzer settings:
-analyzer.archive.enabled=true
-analyzer.jar.enabled=true
-analyzer.nuspec.enabled=true
-analyzer.assembly.enabled=true
-analyzer.composer.lock.enabled=true
-
# the URL for searching Nexus for SHA-1 hashes and whether it's enabled
analyzer.nexus.enabled=true
analyzer.nexus.url=https://repository.sonatype.org/service/local/
@@ -87,7 +80,7 @@ archive.scan.depth=3
# use HEAD (default) or GET as HTTP request method for query timestamp
downloader.quick.query.timestamp=true
-
+analyzer.experimental.enabled=false
analyzer.jar.enabled=true
analyzer.archive.enabled=true
analyzer.node.package.enabled=true
diff --git a/dependency-check-core/src/test/java/org/owasp/dependencycheck/analyzer/AnalyzerServiceTest.java b/dependency-check-core/src/test/java/org/owasp/dependencycheck/analyzer/AnalyzerServiceTest.java
index befa0692c..229e61d9b 100644
--- a/dependency-check-core/src/test/java/org/owasp/dependencycheck/analyzer/AnalyzerServiceTest.java
+++ b/dependency-check-core/src/test/java/org/owasp/dependencycheck/analyzer/AnalyzerServiceTest.java
@@ -18,9 +18,12 @@
package org.owasp.dependencycheck.analyzer;
import java.util.Iterator;
+import java.util.List;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.owasp.dependencycheck.BaseDBTestCase;
+import org.owasp.dependencycheck.utils.Settings;
/**
*
@@ -34,15 +37,42 @@ public class AnalyzerServiceTest extends BaseDBTestCase {
@Test
public void testGetAnalyzers() {
AnalyzerService instance = new AnalyzerService(Thread.currentThread().getContextClassLoader());
- Iterator result = instance.getAnalyzers();
+ List result = instance.getAnalyzers();
boolean found = false;
- while (result.hasNext()) {
- Analyzer a = result.next();
+ for (Analyzer a : result) {
if ("Jar Analyzer".equals(a.getName())) {
found = true;
}
}
assertTrue("JarAnalyzer loaded", found);
}
+
+ /**
+ * Test of getAnalyzers method, of class AnalyzerService.
+ */
+ @Test
+ public void testGetExperimentalAnalyzers() {
+ Settings.setBoolean(Settings.KEYS.ANALYZER_EXPERIMENTAL_ENABLED, false);
+ AnalyzerService instance = new AnalyzerService(Thread.currentThread().getContextClassLoader());
+ List result = instance.getAnalyzers();
+ String experimental = "CMake Analyzer";
+ boolean found = false;
+ for (Analyzer a : result) {
+ if (experimental.equals(a.getName())) {
+ found = true;
+ }
+ }
+ assertFalse("Experimental analyzer loaded when set to false", found);
+
+ Settings.setBoolean(Settings.KEYS.ANALYZER_EXPERIMENTAL_ENABLED, true);
+ result = instance.getAnalyzers();
+ found = false;
+ for (Analyzer a : result) {
+ if (experimental.equals(a.getName())) {
+ found = true;
+ }
+ }
+ assertTrue("Experimental analyzer not loaded when set to true", found);
+ }
}
diff --git a/dependency-check-core/src/test/java/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzerTest.java b/dependency-check-core/src/test/java/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzerTest.java
index 64afd6c52..e72a672a3 100644
--- a/dependency-check-core/src/test/java/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzerTest.java
+++ b/dependency-check-core/src/test/java/org/owasp/dependencycheck/analyzer/RubyBundleAuditAnalyzerTest.java
@@ -65,7 +65,7 @@ public class RubyBundleAuditAnalyzerTest extends BaseDBTestCase {
*/
@Before
public void setUp() throws Exception {
- Settings.initialize();
+ Settings.initialize();
analyzer = new RubyBundleAuditAnalyzer();
analyzer.setFilesMatched(true);
}
@@ -77,7 +77,7 @@ public class RubyBundleAuditAnalyzerTest extends BaseDBTestCase {
*/
@After
public void tearDown() throws Exception {
- Settings.cleanup();
+ Settings.cleanup();
analyzer.close();
analyzer = null;
}
@@ -105,7 +105,7 @@ public class RubyBundleAuditAnalyzerTest extends BaseDBTestCase {
*/
@Test
public void testAnalysis() throws AnalysisException, DatabaseException {
- try {
+ try {
analyzer.initialize();
final String resource = "ruby/vulnerable/gems/rails-4.1.15/Gemfile.lock";
final Dependency result = new Dependency(BaseTest.getResourceAsFile(this, resource));
@@ -139,7 +139,6 @@ public class RubyBundleAuditAnalyzerTest extends BaseDBTestCase {
final Engine engine = new Engine();
analyzer.analyze(result, engine);
-
Dependency dependency = engine.getDependencies().get(0);
Vulnerability vulnerability = dependency.getVulnerabilities().first();
assertEquals(vulnerability.getCvssScore(), 5.0f, 0.0);
@@ -150,7 +149,6 @@ public class RubyBundleAuditAnalyzerTest extends BaseDBTestCase {
}
}
-
/**
* Test when Ruby bundle-audit is not available on the system.
*
@@ -158,17 +156,16 @@ public class RubyBundleAuditAnalyzerTest extends BaseDBTestCase {
*/
@Test
public void testMissingBundleAudit() throws AnalysisException, DatabaseException {
- //set a non-exist bundle-audit
+ //set a non-exist bundle-audit
Settings.setString(Settings.KEYS.ANALYZER_BUNDLE_AUDIT_PATH, "phantom-bundle-audit");
try {
//initialize should fail.
- analyzer.initialize();
- } catch (Exception e) {
- //expected, so ignore.
- }
- finally {
- assertThat(analyzer.isEnabled(), is(false));
- LOGGER.info("phantom-bundle-audit is not available. Ruby Bundle Audit Analyzer is disabled as expected.");
+ analyzer.initialize();
+ } catch (Exception e) {
+ //expected, so ignore.
+ } finally {
+ assertThat(analyzer.isEnabled(), is(false));
+ LOGGER.info("phantom-bundle-audit is not available. Ruby Bundle Audit Analyzer is disabled as expected.");
}
}
diff --git a/dependency-check-core/src/test/resources/dependencycheck.properties b/dependency-check-core/src/test/resources/dependencycheck.properties
index 8d4e7a035..ed207a3ff 100644
--- a/dependency-check-core/src/test/resources/dependencycheck.properties
+++ b/dependency-check-core/src/test/resources/dependencycheck.properties
@@ -58,12 +58,6 @@ cve.url-2.0.base=https://nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-%d.xml.gz
cpe.validfordays=30
cpe.url=http://static.nvd.nist.gov/feeds/xml/cpe/dictionary/official-cpe-dictionary_v2.3.xml.gz
-# file type analyzer settings:
-analyzer.archive.enabled=true
-analyzer.jar.enabled=true
-analyzer.nuspec.enabled=true
-analyzer.assembly.enabled=true
-analyzer.composer.lock.enabled=true
# the URL for searching Nexus for SHA-1 hashes and whether it's enabled
analyzer.nexus.enabled=true
@@ -82,7 +76,7 @@ archive.scan.depth=3
# use HEAD (default) or GET as HTTP request method for query timestamp
downloader.quick.query.timestamp=true
-
+analyzer.experimental.enabled=true
analyzer.jar.enabled=true
analyzer.archive.enabled=true
analyzer.node.package.enabled=true
diff --git a/dependency-check-maven/src/main/java/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.java b/dependency-check-maven/src/main/java/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.java
index 57e8677be..070c6e693 100644
--- a/dependency-check-maven/src/main/java/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.java
+++ b/dependency-check-maven/src/main/java/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.java
@@ -94,24 +94,32 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
@Parameter(defaultValue = "${project.build.directory}", required = true)
private File outputDirectory;
/**
- * Specifies the destination directory for the generated Dependency-Check report. This generally maps to "target/site".
+ * Specifies the destination directory for the generated Dependency-Check
+ * report. This generally maps to "target/site".
*/
@Parameter(property = "project.reporting.outputDirectory", required = true)
private File reportOutputDirectory;
/**
- * Specifies if the build should be failed if a CVSS score above a specified level is identified. The default is 11 which
- * means since the CVSS scores are 0-10, by default the build will never fail.
+ * Specifies if the build should be failed if a CVSS score above a specified
+ * level is identified. The default is 11 which means since the CVSS scores
+ * are 0-10, by default the build will never fail.
*/
@SuppressWarnings("CanBeFinal")
@Parameter(property = "failBuildOnCVSS", defaultValue = "11", required = true)
private float failBuildOnCVSS = 11;
/**
- * Sets whether auto-updating of the NVD CVE/CPE data is enabled. It is not recommended that this be turned to false. Default
- * is true.
+ * Sets whether auto-updating of the NVD CVE/CPE data is enabled. It is not
+ * recommended that this be turned to false. Default is true.
*/
@SuppressWarnings("CanBeFinal")
@Parameter(property = "autoUpdate")
private Boolean autoUpdate;
+ /**
+ * Sets whether Experimental analyzers are enabled. Default is false.
+ */
+ @SuppressWarnings("CanBeFinal")
+ @Parameter(property = "enableExperimental")
+ private Boolean enableExperimental;
/**
* Generate aggregate reports in multi-module projects.
*
@@ -121,8 +129,9 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
@Deprecated
private Boolean aggregate;
/**
- * The report format to be generated (HTML, XML, VULN, ALL). This configuration option has no affect if using this within the
- * Site plug-in unless the externalReport is set to true. Default is HTML.
+ * The report format to be generated (HTML, XML, VULN, ALL). This
+ * configuration option has no affect if using this within the Site plug-in
+ * unless the externalReport is set to true. Default is HTML.
*/
@SuppressWarnings("CanBeFinal")
@Parameter(property = "format", defaultValue = "HTML", required = true)
@@ -234,7 +243,8 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
private Boolean nexusAnalyzerEnabled;
/**
- * The URL of a Nexus server's REST API end point (http://domain/nexus/service/local).
+ * The URL of a Nexus server's REST API end point
+ * (http://domain/nexus/service/local).
*/
@Parameter(property = "nexusUrl", required = false)
private String nexusUrl;
@@ -268,7 +278,8 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
@Parameter(property = "databaseDriverPath", defaultValue = "", required = false)
private String databaseDriverPath;
/**
- * The server id in the settings.xml; used to retrieve encrypted passwords from the settings.xml.
+ * The server id in the settings.xml; used to retrieve encrypted passwords
+ * from the settings.xml.
*/
@Parameter(property = "serverId", defaultValue = "", required = false)
private String serverId;
@@ -293,7 +304,8 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
@Parameter(property = "databasePassword", defaultValue = "", required = false)
private String databasePassword;
/**
- * A comma-separated list of file extensions to add to analysis next to jar, zip, ....
+ * A comma-separated list of file extensions to add to analysis next to jar,
+ * zip, ....
*/
@Parameter(property = "zipExtensions", required = false)
private String zipExtensions;
@@ -347,7 +359,8 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
@Parameter(property = "cveUrl20Base", defaultValue = "", required = false)
private String cveUrl20Base;
/**
- * Optionally skip excessive CVE update checks for a designated duration in hours.
+ * Optionally skip excessive CVE update checks for a designated duration in
+ * hours.
*/
@Parameter(property = "cveValidForHours", defaultValue = "", required = false)
private Integer cveValidForHours;
@@ -382,7 +395,8 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
/**
* Executes dependency-check.
*
- * @throws MojoExecutionException thrown if there is an exception executing the mojo
+ * @throws MojoExecutionException thrown if there is an exception executing
+ * the mojo
* @throws MojoFailureException thrown if dependency-check failed the build
*/
@Override
@@ -398,8 +412,9 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
}
/**
- * Checks if the aggregate configuration parameter has been set to true. If it has a MojoExecutionException is thrown because
- * the aggregate configuration parameter is no longer supported.
+ * Checks if the aggregate configuration parameter has been set to true. If
+ * it has a MojoExecutionException is thrown because the aggregate
+ * configuration parameter is no longer supported.
*
* @throws MojoExecutionException thrown if aggregate is set to true
*/
@@ -417,7 +432,9 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
* @param sink the sink to write the report to
* @param locale the locale to use when generating the report
* @throws MavenReportException if a maven report exception occurs
- * @deprecated use {@link #generate(org.apache.maven.doxia.sink.Sink, java.util.Locale)} instead.
+ * @deprecated use
+ * {@link #generate(org.apache.maven.doxia.sink.Sink, java.util.Locale)}
+ * instead.
*/
@Override
@Deprecated
@@ -464,17 +481,20 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
}
/**
- * Returns the correct output directory depending on if a site is being executed or not.
+ * Returns the correct output directory depending on if a site is being
+ * executed or not.
*
* @return the directory to write the report(s)
- * @throws MojoExecutionException thrown if there is an error loading the file path
+ * @throws MojoExecutionException thrown if there is an error loading the
+ * file path
*/
protected File getCorrectOutputDirectory() throws MojoExecutionException {
return getCorrectOutputDirectory(this.project);
}
/**
- * Returns the correct output directory depending on if a site is being executed or not.
+ * Returns the correct output directory depending on if a site is being
+ * executed or not.
*
* @param current the Maven project to get the output directory from
* @return the directory to write the report(s)
@@ -492,7 +512,8 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
}
/**
- * Returns the correct output directory depending on if a site is being executed or not.
+ * Returns the correct output directory depending on if a site is being
+ * executed or not.
*
* @param current the Maven project to get the output directory from
* @return the directory to write the report(s)
@@ -507,16 +528,15 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
final File f = new File((String) obj);
return f;
}
- } else {
- if (getLog().isDebugEnabled()) {
- getLog().debug("Context value not found");
- }
+ } else if (getLog().isDebugEnabled()) {
+ getLog().debug("Context value not found");
}
return null;
}
/**
- * Scans the project's artifacts and adds them to the engine's dependency list.
+ * Scans the project's artifacts and adds them to the engine's dependency
+ * list.
*
* @param project the project to scan the dependencies of
* @param engine the engine to use to scan the dependencies
@@ -539,12 +559,10 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
d.getDisplayFileName()));
}
}
- } else {
- if (getLog().isDebugEnabled()) {
- final String msg = String.format("More then 1 dependency was identified in first pass scan of '%s:%s:%s'",
- a.getGroupId(), a.getArtifactId(), a.getVersion());
- getLog().debug(msg);
- }
+ } else if (getLog().isDebugEnabled()) {
+ final String msg = String.format("More then 1 dependency was identified in first pass scan of '%s:%s:%s'",
+ a.getGroupId(), a.getArtifactId(), a.getVersion());
+ getLog().debug(msg);
}
}
}
@@ -553,8 +571,10 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
/**
* Executes the dependency-check scan and generates the necassary report.
*
- * @throws MojoExecutionException thrown if there is an exception running the scan
- * @throws MojoFailureException thrown if dependency-check is configured to fail the build
+ * @throws MojoExecutionException thrown if there is an exception running
+ * the scan
+ * @throws MojoFailureException thrown if dependency-check is configured to
+ * fail the build
*/
public abstract void runCheck() throws MojoExecutionException, MojoFailureException;
@@ -588,7 +608,8 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
}
/**
- * Returns whether this is an external report. This method always returns true.
+ * Returns whether this is an external report. This method always returns
+ * true.
*
* @return true
*/
@@ -640,8 +661,9 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
}
/**
- * Takes the properties supplied and updates the dependency-check settings. Additionally, this sets the system properties
- * required to change the proxy url, port, and connection timeout.
+ * Takes the properties supplied and updates the dependency-check settings.
+ * Additionally, this sets the system properties required to change the
+ * proxy url, port, and connection timeout.
*/
protected void populateSettings() {
Settings.initialize();
@@ -667,6 +689,8 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
}
Settings.setBooleanIfNotNull(Settings.KEYS.AUTO_UPDATE, autoUpdate);
+ Settings.setBooleanIfNotNull(Settings.KEYS.ANALYZER_EXPERIMENTAL_ENABLED, enableExperimental);
+
if (externalReport != null) {
getLog().warn("The 'externalReport' option was set; this configuration option has been removed. "
+ "Please update the dependency-check-maven plugin's configuration");
@@ -795,10 +819,12 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
}
/**
- * Tests is the artifact should be included in the scan (i.e. is the dependency in a scope that is being scanned).
+ * Tests is the artifact should be included in the scan (i.e. is the
+ * dependency in a scope that is being scanned).
*
* @param a the Artifact to test
- * @return true if the artifact is in an excluded scope; otherwise false
+ * @return true if the artifact is in an excluded scope;
+ * otherwise false
*/
protected boolean excludeFromScan(Artifact a) {
if (skipTestScope && Artifact.SCOPE_TEST.equals(a.getScope())) {
@@ -814,10 +840,12 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
}
/**
- * Returns a reference to the current project. This method is used instead of auto-binding the project via component
- * annotation in concrete implementations of this. If the child has a @Component MavenProject project; defined
- * then the abstract class (i.e. this class) will not have access to the current project (just the way Maven works with the
- * binding).
+ * Returns a reference to the current project. This method is used instead
+ * of auto-binding the project via component annotation in concrete
+ * implementations of this. If the child has a
+ * @Component MavenProject project; defined then the abstract
+ * class (i.e. this class) will not have access to the current project (just
+ * the way Maven works with the binding).
*
* @return returns a reference to the current project
*/
@@ -886,11 +914,12 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
//
/**
- * Checks to see if a vulnerability has been identified with a CVSS score that is above the threshold set in the
- * configuration.
+ * Checks to see if a vulnerability has been identified with a CVSS score
+ * that is above the threshold set in the configuration.
*
* @param dependencies the list of dependency objects
- * @throws MojoFailureException thrown if a CVSS score is found that is higher then the threshold set
+ * @throws MojoFailureException thrown if a CVSS score is found that is
+ * higher then the threshold set
*/
protected void checkForFailure(List dependencies) throws MojoFailureException {
if (failBuildOnCVSS <= 10) {
@@ -919,7 +948,8 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
}
/**
- * Generates a warning message listing a summary of dependencies and their associated CPE and CVE entries.
+ * Generates a warning message listing a summary of dependencies and their
+ * associated CPE and CVE entries.
*
* @param mp the Maven project for which the summary is shown
* @param dependencies a list of dependency objects
@@ -963,8 +993,9 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
//
//
/**
- * Returns the key used to store the path to the data file that is saved by writeDataFile(). This key is used in
- * the MavenProject.(set|get)ContextValue.
+ * Returns the key used to store the path to the data file that is saved by
+ * writeDataFile(). This key is used in the
+ * MavenProject.(set|get)ContextValue.
*
* @return the key used to store the path to the data file
*/
@@ -973,8 +1004,9 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
}
/**
- * Returns the key used to store the path to the output directory. When generating the report in the
- * executeAggregateReport() the output directory should be obtained by using this key.
+ * Returns the key used to store the path to the output directory. When
+ * generating the report in the executeAggregateReport() the
+ * output directory should be obtained by using this key.
*
* @return the key used to store the path to the output directory
*/
@@ -983,7 +1015,8 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
}
/**
- * Writes the scan data to disk. This is used to serialize the scan data between the "check" and "aggregate" phase.
+ * Writes the scan data to disk. This is used to serialize the scan data
+ * between the "check" and "aggregate" phase.
*
* @param mp the mMven project for which the data file was created
* @param writeTo the directory to write the data file
@@ -1037,12 +1070,12 @@ public abstract class BaseDependencyCheckMojo extends AbstractMojo implements Ma
}
/**
- * Reads the serialized scan data from disk. This is used to serialize the scan data between the "check" and "aggregate"
- * phase.
+ * Reads the serialized scan data from disk. This is used to serialize the
+ * scan data between the "check" and "aggregate" phase.
*
* @param project the Maven project to read the data file from
- * @return a Engine object populated with dependencies if the serialized data file exists; otherwise
- * null is returned
+ * @return a Engine object populated with dependencies if the
+ * serialized data file exists; otherwise null is returned
*/
protected List readDataFile(MavenProject project) {
final Object oPath = project.getContextValue(this.getDataFileContextKey());
diff --git a/dependency-check-maven/src/main/java/org/slf4j/impl/StaticLoggerBinder.java b/dependency-check-maven/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
index bb9c6f538..af66c7ee3 100644
--- a/dependency-check-maven/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
+++ b/dependency-check-maven/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
@@ -23,8 +23,9 @@ import org.slf4j.ILoggerFactory;
import org.slf4j.spi.LoggerFactoryBinder;
/**
- * The binding of org.slf4j.LoggerFactory class with an actual instance of org.slf4j.ILoggerFactory is performed using information
- * returned by this class.
+ * The binding of org.slf4j.LoggerFactory class with an actual instance of
+ * org.slf4j.ILoggerFactory is performed using information returned by this
+ * class.
*
* @author colezlaw
*/
@@ -47,7 +48,7 @@ public class StaticLoggerBinder implements LoggerFactoryBinder {
}
/**
- * Maven mojos have their own logger, so we'll use one of those
+ * Maven mojos have their own logger, so we'll use one of those.
*/
private Log log = null;
@@ -62,8 +63,8 @@ public class StaticLoggerBinder implements LoggerFactoryBinder {
}
/**
- * Declare the version of the SLF4J API this implementation is compiled against. The value of this filed is usually modified
- * with each release.
+ * Declare the version of the SLF4J API this implementation is compiled
+ * against. The value of this filed is usually modified with each release.
*/
// to avoid constant folding by the compiler, this field must *not* be final
//CSOFF: StaticVariableName
@@ -78,7 +79,8 @@ public class StaticLoggerBinder implements LoggerFactoryBinder {
private static final String LOGGER_FACTORY_CLASS = MavenLoggerFactory.class.getName();
/**
- * The ILoggerFactory instance returned by the {@link #getLoggerFactory} method should always be the same object
+ * The ILoggerFactory instance returned by the {@link #getLoggerFactory}
+ * method should always be the same object
*/
private ILoggerFactory loggerFactory;
diff --git a/dependency-check-maven/src/site/markdown/configuration.md b/dependency-check-maven/src/site/markdown/configuration.md
index 7e64ab216..e35574aff 100644
--- a/dependency-check-maven/src/site/markdown/configuration.md
+++ b/dependency-check-maven/src/site/markdown/configuration.md
@@ -21,10 +21,11 @@ format | The report format to be generated (HTML, XML, VULN, ALL).
name | The name of the report in the site | dependency-check or dependency-check:aggregate
outputDirectory | The location to write the report(s). Note, this is not used if generating the report as part of a `mvn site` build | 'target'
skip | Skips the dependency-check analysis | false
-skipTestScope | Should be skip analysis for artifacts with Test Scope | true
-skipProvidedScope | Should be skip analysis for artifacts with Provided Scope | false
-skipRuntimeScope | Should be skip analysis for artifacts with Runtime Scope | false
+skipTestScope | Skip analysis for artifacts with Test Scope | true
+skipProvidedScope | Skip analysis for artifacts with Provided Scope | false
+skipRuntimeScope | Skip analysis for artifacts with Runtime Scope | false
suppressionFile | The file path to the XML suppression file \- used to suppress [false positives](../general/suppression.html) |
+enableExperimental | Enable the experimental analyzers | false
Analyzer Configuration
====================
diff --git a/dependency-check-utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java b/dependency-check-utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java
index 8f1f38147..924e355cd 100644
--- a/dependency-check-utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java
+++ b/dependency-check-utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java
@@ -189,6 +189,10 @@ public final class Settings {
* The properties key for whether the Jar Analyzer is enabled.
*/
public static final String ANALYZER_JAR_ENABLED = "analyzer.jar.enabled";
+ /**
+ * The properties key for whether experimental analyzers are loaded.
+ */
+ public static final String ANALYZER_EXPERIMENTAL_ENABLED = "analyzer.experimental.enabled";
/**
* The properties key for whether the Archive analyzer is enabled.
*/
@@ -309,7 +313,7 @@ public final class Settings {
/**
* Thread local settings.
*/
- private static ThreadLocal localSettings = new ThreadLocal();
+ private static final ThreadLocal LOCAL_SETTINGS = new ThreadLocal();
/**
* The properties.
*/
@@ -346,7 +350,7 @@ public final class Settings {
* also call Settings.cleanup() to properly release resources.
*/
public static void initialize() {
- localSettings.set(new Settings(PROPERTIES_FILE));
+ LOCAL_SETTINGS.set(new Settings(PROPERTIES_FILE));
}
/**
@@ -356,7 +360,7 @@ public final class Settings {
* @param propertiesFilePath the path to the base properties file to load
*/
public static void initialize(String propertiesFilePath) {
- localSettings.set(new Settings(propertiesFilePath));
+ LOCAL_SETTINGS.set(new Settings(propertiesFilePath));
}
/**
@@ -385,7 +389,7 @@ public final class Settings {
}
}
try {
- localSettings.remove();
+ LOCAL_SETTINGS.remove();
} catch (Throwable ex) {
LOGGER.debug("Error cleaning up Settings", ex);
}
@@ -397,7 +401,7 @@ public final class Settings {
* @return the Settings object
*/
public static Settings getInstance() {
- return localSettings.get();
+ return LOCAL_SETTINGS.get();
}
/**
@@ -406,7 +410,7 @@ public final class Settings {
* @param instance the instance of the settings object to use in this thread
*/
public static void setInstance(Settings instance) {
- localSettings.set(instance);
+ LOCAL_SETTINGS.set(instance);
}
/**
@@ -452,7 +456,7 @@ public final class Settings {
* @param value the value for the property
*/
public static void setString(String key, String value) {
- localSettings.get().props.setProperty(key, value);
+ LOCAL_SETTINGS.get().props.setProperty(key, value);
LOGGER.debug("Setting: {}='{}'", key, value);
}
@@ -509,7 +513,7 @@ public final class Settings {
* @param value the value for the property
*/
public static void setInt(String key, int value) {
- localSettings.get().props.setProperty(key, String.valueOf(value));
+ LOCAL_SETTINGS.get().props.setProperty(key, String.valueOf(value));
LOGGER.debug("Setting: {}='{}'", key, value);
}
@@ -584,8 +588,8 @@ public final class Settings {
* @throws IOException is thrown when there is an exception loading/merging the properties
*/
public static void mergeProperties(InputStream stream) throws IOException {
- localSettings.get().props.load(stream);
- logProperties("Properties updated via merge", localSettings.get().props);
+ LOCAL_SETTINGS.get().props.load(stream);
+ logProperties("Properties updated via merge", LOCAL_SETTINGS.get().props);
}
/**
@@ -665,7 +669,7 @@ public final class Settings {
* @return the property from the properties file
*/
public static String getString(String key, String defaultValue) {
- final String str = System.getProperty(key, localSettings.get().props.getProperty(key, defaultValue));
+ final String str = System.getProperty(key, LOCAL_SETTINGS.get().props.getProperty(key, defaultValue));
return str;
}
@@ -699,7 +703,7 @@ public final class Settings {
* @return the property from the properties file
*/
public static String getString(String key) {
- return System.getProperty(key, localSettings.get().props.getProperty(key));
+ return System.getProperty(key, LOCAL_SETTINGS.get().props.getProperty(key));
}
/**
@@ -708,7 +712,7 @@ public final class Settings {
* @param key the property key to remove
*/
public static void removeProperty(String key) {
- localSettings.get().props.remove(key);
+ LOCAL_SETTINGS.get().props.remove(key);
}
/**