Skip to content

Commit 0bdf510

Browse files
committed
Poassibly resolve infinite recursion problem.
1 parent 11a731b commit 0bdf510

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

audit.js

+8-10
Original file line numberDiff line numberDiff line change
@@ -495,17 +495,15 @@ function getDependencyList(depMap, depLookup) {
495495
var depPaths = o.depPaths ? o.depPaths : [spec];
496496
497497
// Only add a dependency once
498-
if(lookup[spec] == undefined) {
498+
// We need both the local and global "auditLookup" tables.
499+
// The global lookup is used to ensure we only audit a
500+
// dependency once, but cannot be done at the same level
501+
// as the local lookup since the sub-dependencies are not
502+
// available at all locations of the dependency tree (depMap).
503+
if(lookup[spec] == undefined && auditLookup[spec] == undefined) {
499504
lookup[spec] = true;
500-
// We need both the local and global "auditLookup" tables.
501-
// The global lookup is used to ensure we only audit a
502-
// dependency once, but cannot be done at the same level
503-
// as the local lookup since the sub-dependencies are not
504-
// available at all locations of the dependency tree (depMap).
505-
if (auditLookup[spec] == undefined) {
506-
auditLookup[spec] = true;
507-
results.push({"pm": pm, "name": name, "version": version, "depPaths": depPaths});
508-
}
505+
auditLookup[spec] = true;
506+
results.push({"pm": pm, "name": name, "version": version, "depPaths": depPaths});
509507
510508
// If there is a possibility of recursive dependencies...
511509
if (o.version) {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "auditjs",
3-
"version": "2.4.3",
3+
"version": "2.4.5",
44
"description": "Audit dependencies to identify known vulnerabilities and maintenance problems",
55
"main": "audit-package.js",
66
"bin": {

0 commit comments

Comments
 (0)