@ThreadSafe public abstract class AbstractNpmAnalyzer extends AbstractFileTypeAnalyzer
| Modifier and Type | Field and Description |
|---|---|
static String |
NPM_DEPENDENCY_ECOSYSTEM
A descriptor for the type of dependencies processed or added by this
analyzer.
|
| Constructor and Description |
|---|
AbstractNpmAnalyzer() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
accept(File pathname)
Determines if the file can be analyzed by the analyzer.
|
protected Dependency |
createDependency(Dependency dependency,
String name,
String version,
String scope)
Construct a dependency object.
|
protected Dependency |
findDependency(Engine engine,
String name,
String version)
Locates the dependency from the list of dependencies that have been
scanned by the engine.
|
void |
gatherEvidence(javax.json.JsonObject json,
Dependency dependency)
Collects evidence from the given JSON for the associated dependency.
|
protected void |
processPackage(Engine engine,
Dependency dependency,
javax.json.JsonArray jsonArray,
String depType)
Processes a part of package.json (as defined by JsonArray) and update the
specified dependency with relevant info.
|
protected void |
processPackage(Engine engine,
Dependency dependency,
javax.json.JsonObject jsonObject,
String depType)
Processes a part of package.json (as defined by JsonObject) and update
the specified dependency with relevant info.
|
protected boolean |
shouldProcess(File pathname)
Determines if the path contains "/node_modules/" or "/bower_components/"
(i.e.
|
getFileFilter, getFilesMatched, newHashSet, prepareAnalyzer, prepareFileTypeAnalyzer, setFilesMatchedanalyze, analyzeDependency, close, closeAnalyzer, getAnalyzerEnabledSettingKey, getSettings, initialize, isEnabled, prepare, setEnabled, supportsParallelProcessingclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitanalyze, close, getAnalysisPhase, getName, initialize, isEnabled, prepare, supportsParallelProcessingpublic static final String NPM_DEPENDENCY_ECOSYSTEM
public boolean accept(File pathname)
accept in interface FileFilteraccept in class AbstractFileTypeAnalyzerpathname - the path to the fileprotected boolean shouldProcess(File pathname) throws AnalysisException
pathname - the path to testtrue if the path does not contain "/node_modules/"
or "/bower_components/"AnalysisException - thrown if the canonical path cannot be obtained
from the given fileprotected Dependency createDependency(Dependency dependency, String name, String version, String scope)
dependency - the parent dependencyname - the name of the dependency to createversion - the version of the dependency to createscope - the scope of the dependency being createdprotected void processPackage(Engine engine, Dependency dependency, javax.json.JsonArray jsonArray, String depType)
engine - the dependency-check enginedependency - the Dependency to updatejsonArray - the jsonArray to parsedepType - the dependency typeprotected void processPackage(Engine engine, Dependency dependency, javax.json.JsonObject jsonObject, String depType)
engine - the dependency-check enginedependency - the Dependency to updatejsonObject - the jsonObject to parsedepType - the dependency typeprotected Dependency findDependency(Engine engine, String name, String version)
engine - the dependency-check enginename - the name of the dependency to findversion - the version of the dependency to findpublic void gatherEvidence(javax.json.JsonObject json,
Dependency dependency)
json - the JSON that contains the evidence to collectdependency - the dependency to add the evidence tooCopyright © 2012–2020 OWASP. All rights reserved.