Merge pull request #767 from esben-semmle/js/unknown-bound-event-handler-receiver

Approved by xiemaisi
This commit is contained in:
semmle-qlci
2019-01-16 08:36:11 +00:00
committed by GitHub
3 changed files with 31 additions and 1 deletions

View File

@@ -18,7 +18,15 @@ private predicate isBoundInMethod(MethodDeclaration method) {
bindingMethod.getDeclaringClass() = method.getDeclaringClass() and
not bindingMethod.isStatic() and
thiz.getBinder().getAstNode() = bindingMethod.getBody()
|
|
exists (DataFlow::MethodCallNode bind, DataFlow::PropWrite w |
// this[x] = <expr>.bind(...)
w = thiz.getAPropertyWrite() and
not exists(w.getPropertyName()) and
bind.getMethodName() = "bind" and
bind.flowsTo(w.getRhs())
)
or
// require("auto-bind")(this)
thiz.flowsTo(DataFlow::moduleImport("auto-bind").getACall().getArgument(0))
or