Class ArchiveAnalyzer
java.lang.Object
org.owasp.dependencycheck.analyzer.AbstractAnalyzer
org.owasp.dependencycheck.analyzer.AbstractFileTypeAnalyzer
org.owasp.dependencycheck.analyzer.ArchiveAnalyzer
- All Implemented Interfaces:
FileFilter, Analyzer, FileTypeAnalyzer
An analyzer that extracts files from archives and ensures any supported files contained within the archive are added to the dependency list.
- Author:
- Jeremy Long
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermines if the file can be analyzed by the analyzer.voidanalyzeDependency(Dependency dependency, Engine engine) Analyzes a given dependency.voidThe close method deletes any temporary files and directories created during analysis.Returns the phase that the analyzer is intended to run in.protected StringReturns the key used in the properties file to reference the analyzer's enabled property.protected FileFilterReturns theFileFilterused to determine which files are to be analyzed.getName()Returns the name of the analyzer.voidinitialize(Settings settings) Initializes the analyzer with the configured settings.voidprepareFileTypeAnalyzer(Engine engine) The prepare method does nothing for this Analyzer.Methods inherited from class AbstractFileTypeAnalyzer
getFilesMatched, newHashSet, prepareAnalyzer, setFilesMatchedMethods inherited from class AbstractAnalyzer
analyze, close, getSettings, isEnabled, prepare, setEnabled, supportsParallelProcessing
-
Constructor Details
-
ArchiveAnalyzer
public ArchiveAnalyzer()Make java compiler happy.
-
-
Method Details
-
initialize
Initializes the analyzer with the configured settings.- Specified by:
initializein interfaceAnalyzer- Overrides:
initializein classAbstractAnalyzer- Parameters:
settings- the configured settings to use
-
getFileFilter
Description copied from class:AbstractFileTypeAnalyzerReturns the
FileFilterused to determine which files are to be analyzed. An example would be an analyzer that inspected Java jar files. Implementors may useFileFilterBuilder.If the analyzer returns null it will not cause additional files to be analyzed, but will be executed against every file loaded.
- Specified by:
getFileFilterin classAbstractFileTypeAnalyzer- Returns:
- the file filter used to determine which files are to be analyzed
-
getName
-
getAnalysisPhase
Returns the phase that the analyzer is intended to run in.- Returns:
- the phase that the analyzer is intended to run in.
-
getAnalyzerEnabledSettingKey
Returns the key used in the properties file to reference the analyzer's enabled property.- Specified by:
getAnalyzerEnabledSettingKeyin classAbstractAnalyzer- Returns:
- the analyzer's enabled property setting key
-
prepareFileTypeAnalyzer
The prepare method does nothing for this Analyzer.- Specified by:
prepareFileTypeAnalyzerin classAbstractFileTypeAnalyzer- Parameters:
engine- a reference to the dependency-check engine- Throws:
InitializationException- is thrown if there is an exception deleting or creating temporary files
-
closeAnalyzer
The close method deletes any temporary files and directories created during analysis.- Overrides:
closeAnalyzerin classAbstractAnalyzer- Throws:
Exception- thrown if there is an exception deleting temporary files
-
accept
Determines if the file can be analyzed by the analyzer. If the npm analyzer are enabled the archive analyzer will skip the node_modules and bower_modules directories.- Specified by:
acceptin interfaceFileFilter- Overrides:
acceptin classAbstractFileTypeAnalyzer- Parameters:
pathname- the path to the file- Returns:
- true if the file can be analyzed by the given analyzer; otherwise false
-
analyzeDependency
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.- Specified by:
analyzeDependencyin classAbstractAnalyzer- Parameters:
dependency- the dependency to analyzeengine- the engine scanning- Throws:
AnalysisException- thrown if there is an analysis exception
-