Skip to content

Commit 640c194

Browse files
author
Max Schaefer
committed
JavaScript: Model util.deprecate as a pre call-graph step.
1 parent 712a216 commit 640c194

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

javascript/ql/src/semmle/javascript/frameworks/NodeJSLib.qll

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import javascript
66
import semmle.javascript.frameworks.HTTP
77
import semmle.javascript.security.SensitiveActions
8+
private import semmle.javascript.dataflow.internal.PreCallGraphStep
89

910
module NodeJSLib {
1011
private GlobalVariable processVariable() { variables(result, "process", any(GlobalScope sc)) }
@@ -610,6 +611,22 @@ module NodeJSLib {
610611
)
611612
}
612613

614+
/**
615+
* A call to `util.deprecate`, considered to introduce data flow from its first argument
616+
* to its result.
617+
*/
618+
private class UtilDeprecateStep extends PreCallGraphStep {
619+
override predicate step(DataFlow::Node pred, DataFlow::Node succ) {
620+
exists(DataFlow::CallNode deprecate |
621+
deprecate = DataFlow::moduleMember("util", "deprecate").getACall() or
622+
deprecate = DataFlow::moduleImport("util-deprecate").getACall()
623+
|
624+
pred = deprecate.getArgument(0) and
625+
succ = deprecate
626+
)
627+
}
628+
}
629+
613630
/**
614631
* A call to a method from module `child_process`.
615632
*/
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
| client2.js:3:6:3:16 | // track: f | Failed to track f here. |

0 commit comments

Comments
 (0)