mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-22 17:19:30 +01:00
Added check for node_modules directory. Will skip if package.json is a node module. Fixes #797
This commit is contained in:
@@ -149,6 +149,12 @@ public class NspAnalyzer extends AbstractFileTypeAnalyzer {
|
|||||||
final File file = dependency.getActualFile();
|
final File file = dependency.getActualFile();
|
||||||
try (JsonReader jsonReader = Json.createReader(FileUtils.openInputStream(file))) {
|
try (JsonReader jsonReader = Json.createReader(FileUtils.openInputStream(file))) {
|
||||||
|
|
||||||
|
// Do not scan the node_modules directory
|
||||||
|
if (file.getCanonicalPath().contains(File.separator + "node_modules" + File.separator )) {
|
||||||
|
LOGGER.debug("Skipping analysis of node module: " + file.getCanonicalPath());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Retrieves the contents of package.json from the Dependency
|
// Retrieves the contents of package.json from the Dependency
|
||||||
final JsonObject packageJson = jsonReader.readObject();
|
final JsonObject packageJson = jsonReader.readObject();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user