Class FalsePositiveAnalyzer

java.lang.Object
org.owasp.dependencycheck.analyzer.AbstractAnalyzer
org.owasp.dependencycheck.analyzer.FalsePositiveAnalyzer
All Implemented Interfaces:
Analyzer

@ThreadSafe public class FalsePositiveAnalyzer extends AbstractAnalyzer
This analyzer attempts to remove some well known false positives - specifically regarding the java runtime.
Author:
Jeremy Long
  • Field Details

    • CORE_JAVA

      public static final Pattern CORE_JAVA
      Regex to identify core java libraries and a few other commonly misidentified ones.
    • CORE_JAVA_JSF

      public static final Pattern CORE_JAVA_JSF
      Regex to identify core jsf libraries.
    • CORE_FILES

      public static final Pattern CORE_FILES
      Regex to identify core java library files. This is currently incomplete.
    • CORE_JSF_FILES

      public static final Pattern CORE_JSF_FILES
      Regex to identify core jsf java library files. This is currently incomplete.
  • Constructor Details

    • FalsePositiveAnalyzer

      public FalsePositiveAnalyzer()
  • Method Details

    • getName

      public String getName()
      Returns the name of the analyzer.
      Returns:
      the name of the analyzer.
    • getAnalysisPhase

      public AnalysisPhase getAnalysisPhase()
      Returns the phase that the analyzer is intended to run in.
      Returns:
      the phase that the analyzer is intended to run in.
    • getAnalyzerEnabledSettingKey

      protected String getAnalyzerEnabledSettingKey()

      Returns the setting key to determine if the analyzer is enabled.

      Specified by:
      getAnalyzerEnabledSettingKey in class AbstractAnalyzer
      Returns:
      the key for the analyzer's enabled property
    • analyzeDependency

      protected void analyzeDependency(Dependency dependency, Engine engine) throws AnalysisException
      Analyzes the dependencies and removes bad/incorrect CPE associations based on various heuristics.
      Specified by:
      analyzeDependency in class AbstractAnalyzer
      Parameters:
      dependency - the dependency to analyze.
      engine - the engine that is scanning the dependencies
      Throws:
      AnalysisException - is thrown if there is an error reading the JAR file.
    • removeBadMatches

      protected void removeBadMatches(Dependency dependency)
      Removes bad CPE matches for a dependency. Unfortunately, right now these are hard-coded patches for specific problems identified when testing this on a LARGE volume of jar files.
      Parameters:
      dependency - the dependency to analyze