Class RubyBundlerAnalyzer
java.lang.Object
org.owasp.dependencycheck.analyzer.AbstractAnalyzer
org.owasp.dependencycheck.analyzer.AbstractFileTypeAnalyzer
org.owasp.dependencycheck.analyzer.RubyGemspecAnalyzer
org.owasp.dependencycheck.analyzer.RubyBundlerAnalyzer
- All Implemented Interfaces:
FileFilter, Analyzer, FileTypeAnalyzer
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
dependency packagePath to where the gem is actually installed. Then during
the
AnalysisPhase.PRE_FINDING_ANALYSIS
DependencyMergingAnalyzer will merge two .gemspec dependencies
together if Dependency.getPackagePath() are the same.
Ruby bundler creates new .gemspec files under a folder called
"specifications" at deploy time, in addition to the original .gemspec files
from source. The bundler generated .gemspec files always contain fully
resolved attributes thus provide more accurate evidences, whereas the
original .gemspec from source often contain variables for attributes that
can't be used for evidences.
Note this analyzer share the same
Settings.KEYS.ANALYZER_RUBY_GEMSPEC_ENABLED
as RubyGemspecAnalyzer, so it will enabled/disabled with
RubyGemspecAnalyzer.- Author:
- Bianca Jiang (https://twitter.com/biancajiang)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringA descriptor for the type of dependencies processed or added by this analyzer. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanOnly accept *.gemspec files generated by "bundle install --deployment" under "specifications" folder.protected voidanalyzeDependency(Dependency dependency, Engine engine) Analyzes a given dependency.getName()Returns the name of the analyzer.Methods inherited from class RubyGemspecAnalyzer
getAnalysisPhase, getAnalyzerEnabledSettingKey, getFileFilter, prepareFileTypeAnalyzerMethods inherited from class AbstractFileTypeAnalyzer
getFilesMatched, newHashSet, prepareAnalyzer, setFilesMatchedMethods inherited from class AbstractAnalyzer
analyze, close, closeAnalyzer, getSettings, initialize, isEnabled, prepare, setEnabled, supportsParallelProcessingMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Analyzer
analyze, close, initialize, isEnabled, prepare, supportsParallelProcessing
-
Field Details
-
DEPENDENCY_ECOSYSTEM
A descriptor for the type of dependencies processed or added by this analyzer.- See Also:
-
-
Constructor Details
-
RubyBundlerAnalyzer
public RubyBundlerAnalyzer()
-
-
Method Details
-
getName
Returns the name of the analyzer.- Specified by:
getNamein interfaceAnalyzer- Overrides:
getNamein classRubyGemspecAnalyzer- Returns:
- the name of the analyzer.
-
accept
Only accept *.gemspec files generated by "bundle install --deployment" under "specifications" folder.- Specified by:
acceptin interfaceFileFilter- Overrides:
acceptin classAbstractFileTypeAnalyzer- Parameters:
pathname- the path name to test- Returns:
- true if the analyzer can process the given file; otherwise false
-
analyzeDependency
Description copied from class:AbstractAnalyzerAnalyzes 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.- Overrides:
analyzeDependencyin classRubyGemspecAnalyzer- Parameters:
dependency- the dependency to analyzeengine- the engine scanning- Throws:
AnalysisException- thrown if there is an analysis exception
-