Skip to content
This repository was archived by the owner on Dec 4, 2021. It is now read-only.

Commit 2c90617

Browse files
Caleb HooverCaleb Hoover
Caleb Hoover
authored and
Caleb Hoover
committed
will only report sinks that have sources (userinput)
1 parent f782556 commit 2c90617

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

check.js

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,16 @@ Scope.prototype.resolveStatement = function(node) {
184184
if (flags.verbose)
185185
this.log('[CES]', node, ceName, ce.raw);
186186

187-
if (typeof ceName == 'string') {
188-
if (this.isSink(ceName)) {
189-
this.log('[SINK]'.red, node, ce.raw, ceName);
190-
}
187+
if (this.isSink(ceName) && ce.arguments) {
188+
ce.arguments.some(function (arg) {
189+
var resolved = scope.resolve(arg);
190+
191+
if (scope.isSource(arg.name || arg) || scope.isSource(resolved.name || resolved)) {
192+
scope.log('[SINK]'.red, node, ceName, ce.arguments?ce.arguments:'');
193+
return true;
194+
}
195+
return false;
196+
});
191197
}
192198

193199
// if (scope.vars[ce.name]) {
@@ -323,8 +329,17 @@ Scope.prototype.resolveExpression = function(right, isSourceCB) {
323329
}
324330

325331
if (this.isSink(ceName)) {
326-
this.log('[SINK]'.red, right, ceName, ce.arguments?ce.arguments:'');
332+
ce.arguments.some(function (arg) {
333+
var resolved = scope.resolve(arg);
334+
335+
if (scope.isSource(arg.name || arg) || scope.isSource(resolved.name || resolved)) {
336+
scope.log('[SINK]'.red, right, ceName, ce.arguments?ce.arguments:'');
337+
return true;
338+
}
339+
return false;
340+
});
327341
}
342+
328343
}
329344

330345
return ce;

0 commit comments

Comments
 (0)