added enabled settings for all analyzers per #612

This commit is contained in:
Jeremy Long
2016-12-26 09:11:26 -05:00
parent 38bf9b4ddb
commit 287b1df3fd
36 changed files with 362 additions and 181 deletions

View File

@@ -17,16 +17,86 @@
*/ */
package org.owasp.dependencycheck.analyzer; package org.owasp.dependencycheck.analyzer;
import org.owasp.dependencycheck.Engine;
import org.owasp.dependencycheck.analyzer.exception.AnalysisException;
import org.owasp.dependencycheck.dependency.Dependency;
import org.owasp.dependencycheck.exception.InitializationException; import org.owasp.dependencycheck.exception.InitializationException;
import org.owasp.dependencycheck.utils.InvalidSettingException;
import org.owasp.dependencycheck.utils.Settings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* Base class for analyzers to avoid code duplication of initialize and close * Base class for analyzers to avoid code duplication of initialize and close as
* as most analyzers do not need these methods. * most analyzers do not need these methods.
* *
* @author Jeremy Long * @author Jeremy Long
*/ */
public abstract class AbstractAnalyzer implements Analyzer { public abstract class AbstractAnalyzer implements Analyzer {
/**
* The logger.
*/
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractAnalyzer.class);
/**
* A flag indicating whether or not the analyzer is enabled.
*/
private volatile boolean enabled = true;
/**
* Get the value of enabled.
*
* @return the value of enabled
*/
@Override
public boolean isEnabled() {
return enabled;
}
/**
* Set the value of enabled.
*
* @param enabled new value of enabled
*/
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
/**
* <p>
* Returns the setting key to determine if the analyzer is enabled.</p>
*
* @return the key for the analyzer's enabled property
*/
protected abstract String getAnalyzerEnabledSettingKey();
/**
* Analyzes a given dependency. If the dependency is an archive, such as a
* WAR or EAR, the contents are extracted, scanned, and added to the list of
* dependencies within the engine.
*
* @param dependency the dependency to analyze
* @param engine the engine scanning
* @throws AnalysisException thrown if there is an analysis exception
*/
protected abstract void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException;
/**
* Analyzes a given dependency. If the dependency is an archive, such as a
* WAR or EAR, the contents are extracted, scanned, and added to the list of
* dependencies within the engine.
*
* @param dependency the dependency to analyze
* @param engine the engine scanning
* @throws AnalysisException thrown if there is an analysis exception
*/
@Override
public final void analyze(Dependency dependency, Engine engine) throws AnalysisException {
if (this.isEnabled()) {
analyzeDependency(dependency, engine);
}
}
/** /**
* The initialize method does nothing for this Analyzer. * The initialize method does nothing for this Analyzer.
* *
@@ -34,7 +104,14 @@ public abstract class AbstractAnalyzer implements Analyzer {
*/ */
@Override @Override
public void initialize() throws InitializationException { public void initialize() throws InitializationException {
//do nothing final String key = getAnalyzerEnabledSettingKey();
try {
this.setEnabled(Settings.getBoolean(key, true));
} catch (InvalidSettingException ex) {
LOGGER.warn("Invalid setting for property '{}'", key);
LOGGER.debug("", ex);
LOGGER.warn("{} has been disabled", getName());
}
} }
/** /**
@@ -49,6 +126,8 @@ public abstract class AbstractAnalyzer implements Analyzer {
/** /**
* The default is to support parallel processing. * The default is to support parallel processing.
*
* @return true
*/ */
@Override @Override
public boolean supportsParallelProcessing() { public boolean supportsParallelProcessing() {

View File

@@ -17,11 +17,6 @@
*/ */
package org.owasp.dependencycheck.analyzer; package org.owasp.dependencycheck.analyzer;
import org.owasp.dependencycheck.Engine;
import org.owasp.dependencycheck.analyzer.exception.AnalysisException;
import org.owasp.dependencycheck.dependency.Dependency;
import org.owasp.dependencycheck.utils.InvalidSettingException;
import org.owasp.dependencycheck.utils.Settings;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -40,17 +35,7 @@ import org.owasp.dependencycheck.exception.InitializationException;
*/ */
public abstract class AbstractFileTypeAnalyzer extends AbstractAnalyzer implements FileTypeAnalyzer { public abstract class AbstractFileTypeAnalyzer extends AbstractAnalyzer implements FileTypeAnalyzer {
//<editor-fold defaultstate="collapsed" desc="Constructor"> //<editor-fold defaultstate="collapsed" desc="Field definitions, getters, and setters ">
/**
* Base constructor that all children must call. This checks the
* configuration to determine if the analyzer is enabled.
*/
public AbstractFileTypeAnalyzer() {
reset();
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Field definitions">
/** /**
* The logger. * The logger.
*/ */
@@ -80,30 +65,25 @@ public abstract class AbstractFileTypeAnalyzer extends AbstractAnalyzer implemen
this.filesMatched = filesMatched; this.filesMatched = filesMatched;
} }
/**
* A flag indicating whether or not the analyzer is enabled.
*/
private volatile boolean enabled = true;
/**
* Get the value of enabled.
*
* @return the value of enabled
*/
public boolean isEnabled() {
return enabled;
}
/**
* Set the value of enabled.
*
* @param enabled new value of enabled
*/
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
//</editor-fold> //</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Final implementations for the Analyzer interface">
/**
* Initializes the analyzer.
*
* @throws InitializationException thrown if there is an exception during
* initialization
*/
@Override
public final void initialize() throws InitializationException {
super.initialize();
if (filesMatched) {
initializeFileTypeAnalyzer();
} else {
this.setEnabled(false);
}
}
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Abstract methods children must implement"> //<editor-fold defaultstate="collapsed" desc="Abstract methods children must implement">
/** /**
* <p> * <p>
@@ -127,80 +107,21 @@ public abstract class AbstractFileTypeAnalyzer extends AbstractAnalyzer implemen
*/ */
protected abstract void initializeFileTypeAnalyzer() throws InitializationException; protected abstract void initializeFileTypeAnalyzer() throws InitializationException;
/**
* Analyzes a given dependency. If the dependency is an archive, such as a
* WAR or EAR, the contents are extracted, scanned, and added to the list of
* dependencies within the engine.
*
* @param dependency the dependency to analyze
* @param engine the engine scanning
* @throws AnalysisException thrown if there is an analysis exception
*/
protected abstract void analyzeFileType(Dependency dependency, Engine engine) throws AnalysisException;
/**
* <p>
* Returns the setting key to determine if the analyzer is enabled.</p>
*
* @return the key for the analyzer's enabled property
*/
protected abstract String getAnalyzerEnabledSettingKey();
//</editor-fold> //</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Final implementations for the Analyzer interface">
/** /**
* Initializes the analyzer. * Determines if the file can be analyzed by the analyzer.
* *
* @throws InitializationException thrown if there is an exception during * @param pathname the path to the file
* initialization * @return true if the file can be analyzed by the given analyzer; otherwise
* false
*/ */
@Override
public final void initialize() throws InitializationException {
if (filesMatched) {
initializeFileTypeAnalyzer();
} else {
enabled = false;
}
}
/**
* Resets the enabled flag on the analyzer.
*/
@Override
public final void reset() {
final String key = getAnalyzerEnabledSettingKey();
try {
enabled = Settings.getBoolean(key, true);
} catch (InvalidSettingException ex) {
LOGGER.warn("Invalid setting for property '{}'", key);
LOGGER.debug("", ex);
LOGGER.warn("{} has been disabled", getName());
}
}
/**
* Analyzes a given dependency. If the dependency is an archive, such as a
* WAR or EAR, the contents are extracted, scanned, and added to the list of
* dependencies within the engine.
*
* @param dependency the dependency to analyze
* @param engine the engine scanning
* @throws AnalysisException thrown if there is an analysis exception
*/
@Override
public final void analyze(Dependency dependency, Engine engine) throws AnalysisException {
if (enabled) {
analyzeFileType(dependency, engine);
}
}
@Override @Override
public boolean accept(File pathname) { public boolean accept(File pathname) {
final FileFilter filter = getFileFilter(); final FileFilter filter = getFileFilter();
boolean accepted = false; boolean accepted = false;
if (null == filter) { if (null == filter) {
LOGGER.error("The '{}' analyzer is misconfigured and does not have a file filter; it will be disabled", getName()); LOGGER.error("The '{}' analyzer is misconfigured and does not have a file filter; it will be disabled", getName());
} else if (enabled) { } else if (this.isEnabled()) {
accepted = filter.accept(pathname); accepted = filter.accept(pathname);
if (accepted) { if (accepted) {
filesMatched = true; filesMatched = true;
@@ -209,8 +130,6 @@ public abstract class AbstractFileTypeAnalyzer extends AbstractAnalyzer implemen
return accepted; return accepted;
} }
//</editor-fold>
//<editor-fold defaultstate="collapsed" desc="Static utility methods">
/** /**
* <p> * <p>
* Utility method to help in the creation of the extensions set. This * Utility method to help in the creation of the extensions set. This
@@ -227,6 +146,4 @@ public abstract class AbstractFileTypeAnalyzer extends AbstractAnalyzer implemen
Collections.addAll(set, strings); Collections.addAll(set, strings);
return set; return set;
} }
//</editor-fold>
} }

View File

@@ -83,4 +83,10 @@ public interface Analyzer {
* @return {@code true} if the analyzer supports parallel processing, {@code false} else * @return {@code true} if the analyzer supports parallel processing, {@code false} else
*/ */
boolean supportsParallelProcessing(); boolean supportsParallelProcessing();
/**
* Get the value of enabled.
*
* @return the value of enabled
*/
boolean isEnabled();
} }

View File

@@ -221,7 +221,7 @@ public class ArchiveAnalyzer extends AbstractFileTypeAnalyzer {
* Does not support parallel processing as it both modifies and iterates * Does not support parallel processing as it both modifies and iterates
* over the engine's list of dependencies. * over the engine's list of dependencies.
* *
* @see #analyzeFileType(Dependency, Engine) * @see #analyzeDependency(Dependency, Engine)
* @see #findMoreDependencies(Engine, File) * @see #findMoreDependencies(Engine, File)
*/ */
@Override @Override
@@ -239,7 +239,7 @@ public class ArchiveAnalyzer extends AbstractFileTypeAnalyzer {
* @throws AnalysisException thrown if there is an analysis exception * @throws AnalysisException thrown if there is an analysis exception
*/ */
@Override @Override
public void analyzeFileType(Dependency dependency, Engine engine) throws AnalysisException { public void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException {
final File f = new File(dependency.getActualFilePath()); final File f = new File(dependency.getActualFilePath());
final File tmpDir = getNextTempDirectory(); final File tmpDir = getNextTempDirectory();
extractFiles(f, tmpDir, engine); extractFiles(f, tmpDir, engine);

View File

@@ -106,7 +106,7 @@ public class AssemblyAnalyzer extends AbstractFileTypeAnalyzer {
* @throws AnalysisException if anything goes sideways * @throws AnalysisException if anything goes sideways
*/ */
@Override @Override
public void analyzeFileType(Dependency dependency, Engine engine) public void analyzeDependency(Dependency dependency, Engine engine)
throws AnalysisException { throws AnalysisException {
if (grokAssemblyExe == null) { if (grokAssemblyExe == null) {
LOGGER.warn("GrokAssembly didn't get deployed"); LOGGER.warn("GrokAssembly didn't get deployed");

View File

@@ -154,7 +154,7 @@ public class AutoconfAnalyzer extends AbstractFileTypeAnalyzer {
} }
@Override @Override
protected void analyzeFileType(Dependency dependency, Engine engine) protected void analyzeDependency(Dependency dependency, Engine engine)
throws AnalysisException { throws AnalysisException {
final File actualFile = dependency.getActualFile(); final File actualFile = dependency.getActualFile();
final String name = actualFile.getName(); final String name = actualFile.getName();

View File

@@ -147,7 +147,7 @@ public class CMakeAnalyzer extends AbstractFileTypeAnalyzer {
* analyzing the dependency * analyzing the dependency
*/ */
@Override @Override
protected void analyzeFileType(Dependency dependency, Engine engine) protected void analyzeDependency(Dependency dependency, Engine engine)
throws AnalysisException { throws AnalysisException {
final File file = dependency.getActualFile(); final File file = dependency.getActualFile();
final String parentName = file.getParentFile().getName(); final String parentName = file.getParentFile().getName();

View File

@@ -50,6 +50,7 @@ import org.owasp.dependencycheck.dependency.VulnerableSoftware;
import org.owasp.dependencycheck.exception.InitializationException; import org.owasp.dependencycheck.exception.InitializationException;
import org.owasp.dependencycheck.utils.DependencyVersion; import org.owasp.dependencycheck.utils.DependencyVersion;
import org.owasp.dependencycheck.utils.DependencyVersionUtil; import org.owasp.dependencycheck.utils.DependencyVersionUtil;
import org.owasp.dependencycheck.utils.Settings;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -122,7 +123,14 @@ public class CPEAnalyzer extends AbstractAnalyzer {
public AnalysisPhase getAnalysisPhase() { public AnalysisPhase getAnalysisPhase() {
return AnalysisPhase.IDENTIFIER_ANALYSIS; return AnalysisPhase.IDENTIFIER_ANALYSIS;
} }
/**
* The default is to support parallel processing.
* @return false
*/
@Override
public boolean supportsParallelProcessing() {
return false;
}
/** /**
* Creates the CPE Lucene Index. * Creates the CPE Lucene Index.
* *
@@ -131,6 +139,7 @@ public class CPEAnalyzer extends AbstractAnalyzer {
*/ */
@Override @Override
public void initialize() throws InitializationException { public void initialize() throws InitializationException {
super.initialize();
try { try {
this.open(); this.open();
} catch (IOException ex) { } catch (IOException ex) {
@@ -515,7 +524,7 @@ public class CPEAnalyzer extends AbstractAnalyzer {
* dependency. * dependency.
*/ */
@Override @Override
public synchronized void analyze(Dependency dependency, Engine engine) throws AnalysisException { protected synchronized void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException {
try { try {
determineCPE(dependency); determineCPE(dependency);
} catch (CorruptIndexException ex) { } catch (CorruptIndexException ex) {
@@ -628,6 +637,17 @@ public class CPEAnalyzer extends AbstractAnalyzer {
return identifierAdded; return identifierAdded;
} }
/**
* <p>
* Returns the setting key to determine if the analyzer is enabled.</p>
*
* @return the key for the analyzer's enabled property
*/
@Override
protected String getAnalyzerEnabledSettingKey() {
return Settings.KEYS.ANALYZER_CPE_ENABLED;
}
/** /**
* The confidence whether the identifier is an exact match, or a best guess. * The confidence whether the identifier is an exact match, or a best guess.
*/ */
@@ -808,16 +828,6 @@ public class CPEAnalyzer extends AbstractAnalyzer {
.append(evidenceConfidence, o.evidenceConfidence) .append(evidenceConfidence, o.evidenceConfidence)
.append(identifier, o.identifier) .append(identifier, o.identifier)
.toComparison(); .toComparison();
/*
int conf = this.confidence.compareTo(o.confidence);
if (conf == 0) {
conf = this.evidenceConfidence.compareTo(o.evidenceConfidence);
if (conf == 0) {
conf = identifier.compareTo(o.identifier);
}
}
return conf;
*/
} }
} }
} }

View File

@@ -193,7 +193,7 @@ public class CentralAnalyzer extends AbstractFileTypeAnalyzer {
* @throws AnalysisException when there's an exception during analysis * @throws AnalysisException when there's an exception during analysis
*/ */
@Override @Override
public void analyzeFileType(Dependency dependency, Engine engine) throws AnalysisException { public void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException {
if (errorFlag || !isEnabled()) { if (errorFlag || !isEnabled()) {
return; return;
} }

View File

@@ -119,7 +119,7 @@ public class CocoaPodsAnalyzer extends AbstractFileTypeAnalyzer {
} }
@Override @Override
protected void analyzeFileType(Dependency dependency, Engine engine) protected void analyzeDependency(Dependency dependency, Engine engine)
throws AnalysisException { throws AnalysisException {
String contents; String contents;

View File

@@ -100,7 +100,7 @@ public class ComposerLockAnalyzer extends AbstractFileTypeAnalyzer {
* @throws AnalysisException if there's a failure during analysis * @throws AnalysisException if there's a failure during analysis
*/ */
@Override @Override
protected void analyzeFileType(Dependency dependency, Engine engine) throws AnalysisException { protected void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException {
FileInputStream fis = null; FileInputStream fis = null;
try { try {
fis = new FileInputStream(dependency.getActualFile()); fis = new FileInputStream(dependency.getActualFile());

View File

@@ -20,6 +20,7 @@ package org.owasp.dependencycheck.analyzer;
import org.owasp.dependencycheck.analyzer.exception.AnalysisException; import org.owasp.dependencycheck.analyzer.exception.AnalysisException;
import org.owasp.dependencycheck.Engine; import org.owasp.dependencycheck.Engine;
import org.owasp.dependencycheck.dependency.Dependency; import org.owasp.dependencycheck.dependency.Dependency;
import org.owasp.dependencycheck.utils.Settings;
import org.owasp.dependencycheck.xml.suppression.SuppressionRule; import org.owasp.dependencycheck.xml.suppression.SuppressionRule;
/** /**
@@ -62,7 +63,7 @@ public class CpeSuppressionAnalyzer extends AbstractSuppressionAnalyzer {
//</editor-fold> //</editor-fold>
@Override @Override
public void analyze(final Dependency dependency, final Engine engine) throws AnalysisException { protected void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException {
if (getRules() == null || getRules().size() <= 0) { if (getRules() == null || getRules().size() <= 0) {
return; return;
@@ -72,4 +73,15 @@ public class CpeSuppressionAnalyzer extends AbstractSuppressionAnalyzer {
rule.process(dependency); rule.process(dependency);
} }
} }
/**
* <p>
* Returns the setting key to determine if the analyzer is enabled.</p>
*
* @return the key for the analyzer's enabled property
*/
@Override
protected String getAnalyzerEnabledSettingKey() {
return Settings.KEYS.ANALYZER_CPE_SUPPRESSION_ENABLED;
}
} }

View File

@@ -30,6 +30,7 @@ import org.owasp.dependencycheck.dependency.Dependency;
import org.owasp.dependencycheck.dependency.Identifier; import org.owasp.dependencycheck.dependency.Identifier;
import org.owasp.dependencycheck.utils.DependencyVersion; import org.owasp.dependencycheck.utils.DependencyVersion;
import org.owasp.dependencycheck.utils.DependencyVersionUtil; import org.owasp.dependencycheck.utils.DependencyVersionUtil;
import org.owasp.dependencycheck.utils.Settings;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -119,6 +120,17 @@ public class DependencyBundlingAnalyzer extends AbstractAnalyzer {
return false; return false;
} }
/**
* <p>
* Returns the setting key to determine if the analyzer is enabled.</p>
*
* @return the key for the analyzer's enabled property
*/
@Override
protected String getAnalyzerEnabledSettingKey() {
return Settings.KEYS.ANALYZER_DEPENDENCY_BUNDLING_ENABLED;
}
/** /**
* Analyzes a set of dependencies. If they have been found to have the same * Analyzes a set of dependencies. If they have been found to have the same
* base path and the same set of identifiers they are likely related. The * base path and the same set of identifiers they are likely related. The
@@ -130,7 +142,7 @@ public class DependencyBundlingAnalyzer extends AbstractAnalyzer {
* file. * file.
*/ */
@Override @Override
public synchronized void analyze(Dependency ignore, Engine engine) throws AnalysisException { protected synchronized void analyzeDependency(Dependency ignore, Engine engine) throws AnalysisException {
if (!analyzed) { if (!analyzed) {
analyzed = true; analyzed = true;
final Set<Dependency> dependenciesToRemove = new HashSet<Dependency>(); final Set<Dependency> dependenciesToRemove = new HashSet<Dependency>();

View File

@@ -25,6 +25,7 @@ import java.util.Set;
import org.owasp.dependencycheck.Engine; import org.owasp.dependencycheck.Engine;
import org.owasp.dependencycheck.analyzer.exception.AnalysisException; import org.owasp.dependencycheck.analyzer.exception.AnalysisException;
import org.owasp.dependencycheck.dependency.Dependency; import org.owasp.dependencycheck.dependency.Dependency;
import org.owasp.dependencycheck.utils.Settings;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -100,6 +101,17 @@ public class DependencyMergingAnalyzer extends AbstractAnalyzer {
public boolean supportsParallelProcessing() { public boolean supportsParallelProcessing() {
return false; return false;
} }
/**
* <p>
* Returns the setting key to determine if the analyzer is enabled.</p>
*
* @return the key for the analyzer's enabled property
*/
@Override
protected String getAnalyzerEnabledSettingKey() {
return Settings.KEYS.ANALYZER_DEPENDENCY_MERGING_ENABLED;
}
//</editor-fold> //</editor-fold>
/** /**
@@ -114,7 +126,7 @@ public class DependencyMergingAnalyzer extends AbstractAnalyzer {
* file. * file.
*/ */
@Override @Override
public synchronized void analyze(Dependency ignore, Engine engine) throws AnalysisException { protected synchronized void analyzeDependency(Dependency ignore, Engine engine) throws AnalysisException {
if (!analyzed) { if (!analyzed) {
analyzed = true; analyzed = true;
final Set<Dependency> dependenciesToRemove = new HashSet<Dependency>(); final Set<Dependency> dependenciesToRemove = new HashSet<Dependency>();

View File

@@ -34,6 +34,7 @@ import org.owasp.dependencycheck.dependency.Dependency;
import org.owasp.dependencycheck.dependency.Identifier; import org.owasp.dependencycheck.dependency.Identifier;
import org.owasp.dependencycheck.dependency.VulnerableSoftware; import org.owasp.dependencycheck.dependency.VulnerableSoftware;
import org.owasp.dependencycheck.utils.FileFilterBuilder; import org.owasp.dependencycheck.utils.FileFilterBuilder;
import org.owasp.dependencycheck.utils.Settings;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -83,6 +84,16 @@ public class FalsePositiveAnalyzer extends AbstractAnalyzer {
public AnalysisPhase getAnalysisPhase() { public AnalysisPhase getAnalysisPhase() {
return ANALYSIS_PHASE; return ANALYSIS_PHASE;
} }
/**
* <p>
* Returns the setting key to determine if the analyzer is enabled.</p>
*
* @return the key for the analyzer's enabled property
*/
@Override
protected String getAnalyzerEnabledSettingKey() {
return Settings.KEYS.ANALYZER_FALSE_POSITIVE_ENABLED;
}
//</editor-fold> //</editor-fold>
/** /**
@@ -93,7 +104,7 @@ public class FalsePositiveAnalyzer extends AbstractAnalyzer {
* @throws AnalysisException is thrown if there is an error reading the JAR file. * @throws AnalysisException is thrown if there is an error reading the JAR file.
*/ */
@Override @Override
public void analyze(Dependency dependency, Engine engine) throws AnalysisException { protected void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException {
removeJreEntries(dependency); removeJreEntries(dependency);
removeBadMatches(dependency); removeBadMatches(dependency);
removeBadSpringMatches(dependency); removeBadSpringMatches(dependency);

View File

@@ -27,6 +27,7 @@ import org.owasp.dependencycheck.dependency.Confidence;
import org.owasp.dependencycheck.dependency.Dependency; import org.owasp.dependencycheck.dependency.Dependency;
import org.owasp.dependencycheck.utils.DependencyVersion; import org.owasp.dependencycheck.utils.DependencyVersion;
import org.owasp.dependencycheck.utils.DependencyVersionUtil; import org.owasp.dependencycheck.utils.DependencyVersionUtil;
import org.owasp.dependencycheck.utils.Settings;
/** /**
* *
@@ -65,6 +66,16 @@ public class FileNameAnalyzer extends AbstractAnalyzer {
public AnalysisPhase getAnalysisPhase() { public AnalysisPhase getAnalysisPhase() {
return ANALYSIS_PHASE; return ANALYSIS_PHASE;
} }
/**
* <p>
* Returns the setting key to determine if the analyzer is enabled.</p>
*
* @return the key for the analyzer's enabled property
*/
@Override
protected String getAnalyzerEnabledSettingKey() {
return Settings.KEYS.ANALYZER_FILE_NAME_ENABLED;
}
//</editor-fold> //</editor-fold>
/** /**
@@ -86,7 +97,7 @@ public class FileNameAnalyzer extends AbstractAnalyzer {
* file. * file.
*/ */
@Override @Override
public void analyze(Dependency dependency, Engine engine) throws AnalysisException { protected void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException {
//strip any path information that may get added by ArchiveAnalyzer, etc. //strip any path information that may get added by ArchiveAnalyzer, etc.
final File f = dependency.getActualFile(); final File f = dependency.getActualFile();

View File

@@ -26,8 +26,4 @@ import java.io.FileFilter;
*/ */
public interface FileTypeAnalyzer extends Analyzer, FileFilter { public interface FileTypeAnalyzer extends Analyzer, FileFilter {
/**
* Resets the analyzers state.
*/
void reset();
} }

View File

@@ -82,6 +82,16 @@ public class HintAnalyzer extends AbstractAnalyzer {
public AnalysisPhase getAnalysisPhase() { public AnalysisPhase getAnalysisPhase() {
return ANALYSIS_PHASE; return ANALYSIS_PHASE;
} }
/**
* <p>
* Returns the setting key to determine if the analyzer is enabled.</p>
*
* @return the key for the analyzer's enabled property
*/
@Override
protected String getAnalyzerEnabledSettingKey() {
return Settings.KEYS.ANALYZER_HINT_ENABLED;
}
/** /**
* The initialize method does nothing for this Analyzer. * The initialize method does nothing for this Analyzer.
@@ -90,8 +100,8 @@ public class HintAnalyzer extends AbstractAnalyzer {
*/ */
@Override @Override
public void initialize() throws InitializationException { public void initialize() throws InitializationException {
try {
super.initialize(); super.initialize();
try {
loadHintRules(); loadHintRules();
} catch (HintParseException ex) { } catch (HintParseException ex) {
LOGGER.debug("Unable to parse hint file", ex); LOGGER.debug("Unable to parse hint file", ex);
@@ -123,7 +133,7 @@ public class HintAnalyzer extends AbstractAnalyzer {
* the dependency. * the dependency.
*/ */
@Override @Override
public void analyze(Dependency dependency, Engine engine) throws AnalysisException { protected void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException {
for (HintRule hint : hints.getHintRules()) { for (HintRule hint : hints.getHintRules()) {
boolean shouldAdd = false; boolean shouldAdd = false;
for (Evidence given : hint.getGivenVendor()) { for (Evidence given : hint.getGivenVendor()) {

View File

@@ -227,7 +227,7 @@ public class JarAnalyzer extends AbstractFileTypeAnalyzer {
* file. * file.
*/ */
@Override @Override
public void analyzeFileType(Dependency dependency, Engine engine) throws AnalysisException { public void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException {
try { try {
final List<ClassNameInformation> classNames = collectClassNames(dependency); final List<ClassNameInformation> classNames = collectClassNames(dependency);
final String fileName = dependency.getFileName().toLowerCase(); final String fileName = dependency.getFileName().toLowerCase();
@@ -633,7 +633,8 @@ public class JarAnalyzer extends AbstractFileTypeAnalyzer {
* @return whether evidence was identified parsing the manifest * @return whether evidence was identified parsing the manifest
* @throws IOException if there is an issue reading the JAR file * @throws IOException if there is an issue reading the JAR file
*/ */
protected boolean parseManifest(Dependency dependency, List<ClassNameInformation> classInformation) throws IOException { protected boolean parseManifest(Dependency dependency, List<ClassNameInformation> classInformation)
throws IOException {
boolean foundSomething = false; boolean foundSomething = false;
JarFile jar = null; JarFile jar = null;
try { try {

View File

@@ -218,7 +218,7 @@ public class NexusAnalyzer extends AbstractFileTypeAnalyzer {
* @throws AnalysisException when there's an exception during analysis * @throws AnalysisException when there's an exception during analysis
*/ */
@Override @Override
public void analyzeFileType(Dependency dependency, Engine engine) throws AnalysisException { public void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException {
if (!isEnabled()) { if (!isEnabled()) {
return; return;
} }

View File

@@ -121,7 +121,7 @@ public class NodePackageAnalyzer extends AbstractFileTypeAnalyzer {
} }
@Override @Override
protected void analyzeFileType(Dependency dependency, Engine engine) protected void analyzeDependency(Dependency dependency, Engine engine)
throws AnalysisException { throws AnalysisException {
final File file = dependency.getActualFile(); final File file = dependency.getActualFile();
JsonReader jsonReader; JsonReader jsonReader;

View File

@@ -127,7 +127,7 @@ public class NuspecAnalyzer extends AbstractFileTypeAnalyzer {
* @throws AnalysisException when there's an exception during analysis * @throws AnalysisException when there's an exception during analysis
*/ */
@Override @Override
public void analyzeFileType(Dependency dependency, Engine engine) throws AnalysisException { public void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException {
LOGGER.debug("Checking Nuspec file {}", dependency); LOGGER.debug("Checking Nuspec file {}", dependency);
try { try {
final NuspecParser parser = new XPathNuspecParser(); final NuspecParser parser = new XPathNuspecParser();

View File

@@ -28,15 +28,18 @@ import org.owasp.dependencycheck.dependency.Dependency;
import org.owasp.dependencycheck.dependency.Identifier; import org.owasp.dependencycheck.dependency.Identifier;
import org.owasp.dependencycheck.dependency.Vulnerability; import org.owasp.dependencycheck.dependency.Vulnerability;
import org.owasp.dependencycheck.exception.InitializationException; import org.owasp.dependencycheck.exception.InitializationException;
import org.owasp.dependencycheck.utils.Settings;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/** /**
* NvdCveAnalyzer is a utility class that takes a project dependency and attempts to discern if there is an associated * NvdCveAnalyzer is a utility class that takes a project dependency and
* CVEs. It uses the the identifiers found by other analyzers to lookup the CVE data. * attempts to discern if there is an associated CVEs. It uses the the
* identifiers found by other analyzers to lookup the CVE data.
* *
* @author Jeremy Long * @author Jeremy Long
*/ */
public class NvdCveAnalyzer extends AbstractAnalyzer { public class NvdCveAnalyzer extends AbstractAnalyzer {
/** /**
* The Logger for use throughout the class * The Logger for use throughout the class
*/ */
@@ -56,7 +59,8 @@ public class NvdCveAnalyzer extends AbstractAnalyzer {
* @throws SQLException thrown when there is a SQL Exception * @throws SQLException thrown when there is a SQL Exception
* @throws IOException thrown when there is an IO Exception * @throws IOException thrown when there is an IO Exception
* @throws DatabaseException thrown when there is a database exceptions * @throws DatabaseException thrown when there is a database exceptions
* @throws ClassNotFoundException thrown if the h2 database driver cannot be loaded * @throws ClassNotFoundException thrown if the h2 database driver cannot be
* loaded
*/ */
public void open() throws SQLException, IOException, DatabaseException, ClassNotFoundException { public void open() throws SQLException, IOException, DatabaseException, ClassNotFoundException {
cveDB = new CveDB(); cveDB = new CveDB();
@@ -95,14 +99,16 @@ public class NvdCveAnalyzer extends AbstractAnalyzer {
} }
/** /**
* Analyzes a dependency and attempts to determine if there are any CPE identifiers for this dependency. * Analyzes a dependency and attempts to determine if there are any CPE
* identifiers for this dependency.
* *
* @param dependency The Dependency to analyze * @param dependency The Dependency to analyze
* @param engine The analysis engine * @param engine The analysis engine
* @throws AnalysisException thrown if there is an issue analyzing the dependency * @throws AnalysisException thrown if there is an issue analyzing the
* dependency
*/ */
@Override @Override
public void analyze(Dependency dependency, Engine engine) throws AnalysisException { protected void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException {
for (Identifier id : dependency.getIdentifiers()) { for (Identifier id : dependency.getIdentifiers()) {
if ("cpe".equals(id.getType())) { if ("cpe".equals(id.getType())) {
try { try {
@@ -147,13 +153,26 @@ public class NvdCveAnalyzer extends AbstractAnalyzer {
return AnalysisPhase.FINDING_ANALYSIS; return AnalysisPhase.FINDING_ANALYSIS;
} }
/**
* <p>
* Returns the setting key to determine if the analyzer is enabled.</p>
*
* @return the key for the analyzer's enabled property
*/
@Override
protected String getAnalyzerEnabledSettingKey() {
return Settings.KEYS.ANALYZER_NVD_CVE_ENABLED;
}
/** /**
* Opens the database used to gather NVD CVE data. * Opens the database used to gather NVD CVE data.
* *
* @throws InitializationException is thrown if there is an issue opening the index. * @throws InitializationException is thrown if there is an issue opening
* the index.
*/ */
@Override @Override
public void initialize() throws InitializationException { public void initialize() throws InitializationException {
super.initialize();
try { try {
this.open(); this.open();
} catch (SQLException ex) { } catch (SQLException ex) {

View File

@@ -162,7 +162,7 @@ public class OpenSSLAnalyzer extends AbstractFileTypeAnalyzer {
* analyzing the dependency * analyzing the dependency
*/ */
@Override @Override
protected void analyzeFileType(Dependency dependency, Engine engine) protected void analyzeDependency(Dependency dependency, Engine engine)
throws AnalysisException { throws AnalysisException {
final File file = dependency.getActualFile(); final File file = dependency.getActualFile();
final String parentName = file.getParentFile().getName(); final String parentName = file.getParentFile().getName();

View File

@@ -181,7 +181,7 @@ public class PythonDistributionAnalyzer extends AbstractFileTypeAnalyzer {
} }
@Override @Override
protected void analyzeFileType(Dependency dependency, Engine engine) protected void analyzeDependency(Dependency dependency, Engine engine)
throws AnalysisException { throws AnalysisException {
final File actualFile = dependency.getActualFile(); final File actualFile = dependency.getActualFile();
if (WHL_FILTER.accept(actualFile)) { if (WHL_FILTER.accept(actualFile)) {

View File

@@ -171,7 +171,7 @@ public class PythonPackageAnalyzer extends AbstractFileTypeAnalyzer {
* analyzing the dependency * analyzing the dependency
*/ */
@Override @Override
protected void analyzeFileType(Dependency dependency, Engine engine) protected void analyzeDependency(Dependency dependency, Engine engine)
throws AnalysisException { throws AnalysisException {
final File file = dependency.getActualFile(); final File file = dependency.getActualFile();
final File parent = file.getParentFile(); final File parent = file.getParentFile();

View File

@@ -252,7 +252,7 @@ public class RubyBundleAuditAnalyzer extends AbstractFileTypeAnalyzer {
} }
/** /**
* If {@link #analyzeFileType(Dependency, Engine)} is called, then we have * If {@link #analyzeDependency(Dependency, Engine)} is called, then we have
* successfully initialized, and it will be necessary to disable * successfully initialized, and it will be necessary to disable
* {@link RubyGemspecAnalyzer}. * {@link RubyGemspecAnalyzer}.
*/ */
@@ -266,7 +266,7 @@ public class RubyBundleAuditAnalyzer extends AbstractFileTypeAnalyzer {
* @throws AnalysisException thrown if there is an analysis exception. * @throws AnalysisException thrown if there is an analysis exception.
*/ */
@Override @Override
protected void analyzeFileType(Dependency dependency, Engine engine) protected void analyzeDependency(Dependency dependency, Engine engine)
throws AnalysisException { throws AnalysisException {
if (needToDisableGemspecAnalyzer) { if (needToDisableGemspecAnalyzer) {
boolean failed = true; boolean failed = true;

View File

@@ -27,8 +27,9 @@ import org.owasp.dependencycheck.dependency.Dependency;
/** /**
* This analyzer accepts the fully resolved .gemspec created by the Ruby bundler * This analyzer accepts the fully resolved .gemspec created by the Ruby bundler
* (http://bundler.io) for better evidence results. It also tries to resolve the * (http://bundler.io) for better evidence results. It also tries to resolve the
* dependency packagePath to where the gem is actually installed. Then during {@link org.owasp.dependencycheck.analyzer.AnalysisPhase#PRE_FINDING_ANALYSIS} * dependency packagePath to where the gem is actually installed. Then during
* {@link DependencyBundlingAnalyzer} will merge two .gemspec dependencies * the {@link org.owasp.dependencycheck.analyzer.AnalysisPhase#PRE_FINDING_ANALYSIS}
* {@link DependencyMergingAnalyzer} will merge two .gemspec dependencies
* together if <code>Dependency.getPackagePath()</code> are the same. * together if <code>Dependency.getPackagePath()</code> are the same.
* *
* Ruby bundler creates new .gemspec files under a folder called * Ruby bundler creates new .gemspec files under a folder called
@@ -39,8 +40,8 @@ import org.owasp.dependencycheck.dependency.Dependency;
* can't be used for evidences. * can't be used for evidences.
* *
* Note this analyzer share the same * Note this analyzer share the same
* {@link org.owasp.dependencycheck.utils.Settings.KEYS#ANALYZER_RUBY_GEMSPEC_ENABLED} as * {@link org.owasp.dependencycheck.utils.Settings.KEYS#ANALYZER_RUBY_GEMSPEC_ENABLED}
* {@link RubyGemspecAnalyzer}, so it will enabled/disabled with * as {@link RubyGemspecAnalyzer}, so it will enabled/disabled with
* {@link RubyGemspecAnalyzer}. * {@link RubyGemspecAnalyzer}.
* *
* @author Bianca Jiang (https://twitter.com/biancajiang) * @author Bianca Jiang (https://twitter.com/biancajiang)
@@ -93,9 +94,9 @@ public class RubyBundlerAnalyzer extends RubyGemspecAnalyzer {
} }
@Override @Override
protected void analyzeFileType(Dependency dependency, Engine engine) protected void analyzeDependency(Dependency dependency, Engine engine)
throws AnalysisException { throws AnalysisException {
super.analyzeFileType(dependency, engine); super.analyzeDependency(dependency, engine);
//find the corresponding gem folder for this .gemspec stub by "bundle install --deployment" //find the corresponding gem folder for this .gemspec stub by "bundle install --deployment"
final File gemspecFile = dependency.getActualFile(); final File gemspecFile = dependency.getActualFile();

View File

@@ -130,7 +130,7 @@ public class RubyGemspecAnalyzer extends AbstractFileTypeAnalyzer {
private static final Pattern GEMSPEC_BLOCK_INIT = Pattern.compile("Gem::Specification\\.new\\s+?do\\s+?\\|(.+?)\\|"); private static final Pattern GEMSPEC_BLOCK_INIT = Pattern.compile("Gem::Specification\\.new\\s+?do\\s+?\\|(.+?)\\|");
@Override @Override
protected void analyzeFileType(Dependency dependency, Engine engine) protected void analyzeDependency(Dependency dependency, Engine engine)
throws AnalysisException { throws AnalysisException {
String contents; String contents;
try { try {

View File

@@ -116,7 +116,7 @@ public class SwiftPackageManagerAnalyzer extends AbstractFileTypeAnalyzer {
} }
@Override @Override
protected void analyzeFileType(Dependency dependency, Engine engine) protected void analyzeDependency(Dependency dependency, Engine engine)
throws AnalysisException { throws AnalysisException {
String contents; String contents;

View File

@@ -20,11 +20,13 @@ package org.owasp.dependencycheck.analyzer;
import org.owasp.dependencycheck.analyzer.exception.AnalysisException; import org.owasp.dependencycheck.analyzer.exception.AnalysisException;
import org.owasp.dependencycheck.Engine; import org.owasp.dependencycheck.Engine;
import org.owasp.dependencycheck.dependency.Dependency; import org.owasp.dependencycheck.dependency.Dependency;
import org.owasp.dependencycheck.utils.Settings;
import org.owasp.dependencycheck.xml.suppression.SuppressionRule; import org.owasp.dependencycheck.xml.suppression.SuppressionRule;
/** /**
* The suppression analyzer processes an externally defined XML document that complies with the suppressions.xsd schema. * The suppression analyzer processes an externally defined XML document that
* Any identified Vulnerability entries within the dependencies that match will be removed. * complies with the suppressions.xsd schema. Any identified Vulnerability
* entries within the dependencies that match will be removed.
* *
* @author Jeremy Long * @author Jeremy Long
*/ */
@@ -59,10 +61,29 @@ public class VulnerabilitySuppressionAnalyzer extends AbstractSuppressionAnalyze
public AnalysisPhase getAnalysisPhase() { public AnalysisPhase getAnalysisPhase() {
return ANALYSIS_PHASE; return ANALYSIS_PHASE;
} }
/**
* <p>
* Returns the setting key to determine if the analyzer is enabled.</p>
*
* @return the key for the analyzer's enabled property
*/
@Override
protected String getAnalyzerEnabledSettingKey() {
return Settings.KEYS.ANALYZER_VULNERABILITY_SUPPRESSION_ENABLED;
}
//</editor-fold> //</editor-fold>
/**
* Analyzes a dependency's vulnerabilities against the configured CVE
* suppressions.
*
* @param dependency the dependency being analyzed
* @param engine a reference to the engine orchestrating the analysis
* @throws AnalysisException thrown if there is an error during analysis
*/
@Override @Override
public void analyze(final Dependency dependency, final Engine engine) throws AnalysisException { protected void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException {
if (getRules() == null || getRules().size() <= 0) { if (getRules() == null || getRules().size() <= 0) {
return; return;

View File

@@ -101,4 +101,12 @@ analyzer.cocoapods.enabled=true
analyzer.swift.package.manager.enabled=true analyzer.swift.package.manager.enabled=true
#whether the nexus analyzer uses the proxy #whether the nexus analyzer uses the proxy
analyzer.nexus.proxy=true analyzer.nexus.proxy=true
analyzer.cpe.enabled=true
analyzer.cpesuppression.enabled=true
analyzer.dependencybundling.enabled=true
analyzer.dependencymerging.enabled=true
analyzer.falsepositive.enabled=true
analyzer.filename.enabled=true
analyzer.hint.enabled=true
analyzer.nvdcve.enabled=true
analyzer.vulnerabilitysuppression.enabled=true

View File

@@ -104,7 +104,7 @@ public class AbstractSuppressionAnalyzerTest extends BaseTest {
public class AbstractSuppressionAnalyzerImpl extends AbstractSuppressionAnalyzer { public class AbstractSuppressionAnalyzerImpl extends AbstractSuppressionAnalyzer {
@Override @Override
public void analyze(Dependency dependency, Engine engine) throws AnalysisException { public void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
} }
@@ -117,6 +117,11 @@ public class AbstractSuppressionAnalyzerTest extends BaseTest {
public AnalysisPhase getAnalysisPhase() { public AnalysisPhase getAnalysisPhase() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
} }
@Override
protected String getAnalyzerEnabledSettingKey() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
} }
} }

View File

@@ -41,7 +41,7 @@ public class ArchiveAnalyzerTest extends BaseTest {
} }
/** /**
* Test of analyzeFileType method, of class ArchiveAnalyzer. * Test of analyzeDependency method, of class ArchiveAnalyzer.
*/ */
@Test @Test
public void testZippableExtensions() throws Exception { public void testZippableExtensions() throws Exception {

View File

@@ -4,7 +4,7 @@ autoupdate=true
max.download.threads=3 max.download.threads=3
# the url to obtain the current engine version from # the url to obtain the current engine version from
engine.version.url=http://jeremylong.github.io/DependencyCheck/current.txt engine.version.url=https://jeremylong.github.io/DependencyCheck/current.txt
#temp.directory defaults to System.getProperty("java.io.tmpdir") #temp.directory defaults to System.getProperty("java.io.tmpdir")
#temp.directory=[path to temp directory] #temp.directory=[path to temp directory]
@@ -54,9 +54,10 @@ cve.url-1.2.base=https://nvd.nist.gov/download/nvdcve-%d.xml.gz
#cve.url-1.2.base=http://nvd.nist.gov/download/nvdcve-%d.xml #cve.url-1.2.base=http://nvd.nist.gov/download/nvdcve-%d.xml
cve.url-2.0.base=https://nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-%d.xml.gz cve.url-2.0.base=https://nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-%d.xml.gz
#cve.url-2.0.base=http://static.nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-%d.xml #cve.url-2.0.base=http://static.nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-%d.xml
cve.cpe.startswith.filter=cpe:/a:
cpe.validfordays=30 cpe.validfordays=30
cpe.url=http://static.nvd.nist.gov/feeds/xml/cpe/dictionary/official-cpe-dictionary_v2.3.xml.gz cpe.url=https://static.nvd.nist.gov/feeds/xml/cpe/dictionary/official-cpe-dictionary_v2.3.xml.gz
# the URL for searching Nexus for SHA-1 hashes and whether it's enabled # the URL for searching Nexus for SHA-1 hashes and whether it's enabled
@@ -68,7 +69,7 @@ analyzer.nexus.proxy=true
# the URL for searching search.maven.org for SHA-1 and whether it's enabled # the URL for searching search.maven.org for SHA-1 and whether it's enabled
analyzer.central.enabled=true analyzer.central.enabled=true
analyzer.central.url=http://search.maven.org/solrsearch/select analyzer.central.url=https://search.maven.org/solrsearch/select
# the number of nested archives that will be searched. # the number of nested archives that will be searched.
archive.scan.depth=3 archive.scan.depth=3
@@ -92,8 +93,19 @@ analyzer.nuspec.enabled=true
analyzer.openssl.enabled=true analyzer.openssl.enabled=true
analyzer.central.enabled=true analyzer.central.enabled=true
analyzer.nexus.enabled=false analyzer.nexus.enabled=false
analyzer.cocoapods.enabled=true
analyzer.swift.package.manager.enabled=true
#whether the nexus analyzer uses the proxy #whether the nexus analyzer uses the proxy
analyzer.nexus.proxy=true analyzer.nexus.proxy=true
#Use your own bundle-audit install directory. #Use your own bundle-audit install directory.
analyzer.bundle.audit.path=/usr/local/bin/bundle-audit analyzer.bundle.audit.path=/usr/local/bin/bundle-audit
analyzer.cpe.enabled=true
analyzer.cpesuppression.enabled=true
analyzer.dependencybundling.enabled=true
analyzer.dependencymerging.enabled=true
analyzer.falsepositive.enabled=true
analyzer.filename.enabled=true
analyzer.hint.enabled=true
analyzer.nvdcve.enabled=true
analyzer.vulnerabilitysuppression.enabled=true

View File

@@ -45,13 +45,6 @@ public final class Settings {
*/ */
public static final class KEYS { public static final class KEYS {
/**
* private constructor because this is a "utility" class containing
* constants
*/
private KEYS() {
//do nothing
}
/** /**
* The key to obtain the application name. * The key to obtain the application name.
*/ */
@@ -336,13 +329,58 @@ public final class Settings {
public static final String VFEED_UPDATE_STATUS = "vfeed.update_status"; public static final String VFEED_UPDATE_STATUS = "vfeed.update_status";
/** /**
* The HTTP request method for query last modified date. * The key to the HTTP request method for query last modified date.
*/ */
public static final String DOWNLOADER_QUICK_QUERY_TIMESTAMP = "downloader.quick.query.timestamp"; public static final String DOWNLOADER_QUICK_QUERY_TIMESTAMP = "downloader.quick.query.timestamp";
/** /**
* The HTTP protocol list to use. * The key to HTTP protocol list to use.
*/ */
public static final String DOWNLOADER_TLS_PROTOCOL_LIST = "downloader.tls.protocols"; public static final String DOWNLOADER_TLS_PROTOCOL_LIST = "downloader.tls.protocols";
/**
* The key to determine if the CPE analyzer is enabled.
*/
public static String ANALYZER_CPE_ENABLED = "analyzer.cpe.enabled";
/**
* The key to determine if the CPE Suppression analyzer is enabled.
*/
public static String ANALYZER_CPE_SUPPRESSION_ENABLED = "analyzer.cpesuppression.enabled";
/**
* The key to determine if the Dependency Bundling analyzer is enabled.
*/
public static String ANALYZER_DEPENDENCY_BUNDLING_ENABLED = "analyzer.dependencybundling.enabled";
/**
* The key to determine if the Dependency Merging analyzer is enabled.
*/
public static String ANALYZER_DEPENDENCY_MERGING_ENABLED = "analyzer.dependencymerging.enabled";
/**
* The key to determine if the False Positive analyzer is enabled.
*/
public static String ANALYZER_FALSE_POSITIVE_ENABLED = "analyzer.falsepositive.enabled";
/**
* The key to determine if the File Name analyzer is enabled.
*/
public static String ANALYZER_FILE_NAME_ENABLED = "analyzer.filename.enabled";
/**
* The key to determine if the Hint analyzer is enabled.
*/
public static String ANALYZER_HINT_ENABLED = "analyzer.hint.enabled";
/**
* The key to determine if the NVD CVE analyzer is enabled.
*/
public static String ANALYZER_NVD_CVE_ENABLED = "analyzer.nvdcve.enabled";
/**
* The key to determine if the Vulnerability Suppression analyzer is enabled.
*/
public static String ANALYZER_VULNERABILITY_SUPPRESSION_ENABLED = "analyzer.vulnerabilitysuppression.enabled";
/**
* private constructor because this is a "utility" class containing
* constants
*/
private KEYS() {
//do nothing
}
} }
//</editor-fold> //</editor-fold>