Skip to content

Commit 0b55aed

Browse files
committed
use the EventEmitter registration methods instead of just "on"
1 parent cfbdf21 commit 0b55aed

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ private class WalkFileNameSource extends FileNameSource {
2323
exists(DataFlow::FunctionNode callback |
2424
callback = DataFlow::moduleMember("walk", "walk")
2525
.getACall()
26-
.getAMethodCall("on")
26+
.getAMethodCall(EventEmitter::on())
2727
.getCallback(1)
2828
|
2929
this = callback.getParameter(1).getAPropertyRead("name")
@@ -97,7 +97,7 @@ private class FastGlobFileNameSource extends FileNameSource {
9797
// `file` in `require('fast-glob').stream(_).on(_, file => ...)`
9898
this = DataFlow::moduleMember(moduleName, "stream")
9999
.getACall()
100-
.getAMethodCall("on")
100+
.getAMethodCall(EventEmitter::on())
101101
.getCallback(1)
102102
.getParameter(0)
103103
)

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ module NodeJSLib {
530530
FileStreamRead() {
531531
stream.getMethodName() = "createReadStream" and
532532
this = stream.getAMemberCall(method) and
533-
(method = "read" or method = "pipe" or method = "on")
533+
(method = "read" or method = "pipe" or method = EventEmitter::on())
534534
}
535535

536536
override DataFlow::Node getADataNode() {
@@ -540,7 +540,7 @@ module NodeJSLib {
540540
method = "pipe" and
541541
result = getArgument(0)
542542
or
543-
method = "on" and
543+
method = EventEmitter::on() and
544544
getArgument(0).mayHaveStringValue("data") and
545545
result = getCallback(1).getParameter(0)
546546
}
@@ -751,7 +751,7 @@ module NodeJSLib {
751751
promise = false and
752752
exists(DataFlow::ParameterNode res, DataFlow::CallNode onData |
753753
res = getCallback(1).getParameter(0) and
754-
onData = res.getAMethodCall("on") and
754+
onData = res.getAMethodCall(EventEmitter::on()) and
755755
onData.getArgument(0).mayHaveStringValue("data") and
756756
result = onData.getCallback(1).getParameter(0) and
757757
responseType = "arraybuffer"
@@ -768,7 +768,7 @@ module NodeJSLib {
768768

769769
ClientRequestHandler() {
770770
exists(DataFlow::MethodCallNode mcn |
771-
clientRequest.getAMethodCall("on") = mcn and
771+
clientRequest.getAMethodCall(EventEmitter::on()) = mcn and
772772
mcn.getArgument(0).mayHaveStringValue(handledEvent) and
773773
flowsTo(mcn.getArgument(1))
774774
)
@@ -805,7 +805,7 @@ module NodeJSLib {
805805
private class ClientRequestDataEvent extends RemoteFlowSource {
806806
ClientRequestDataEvent() {
807807
exists(DataFlow::MethodCallNode mcn, ClientRequestResponseEvent cr |
808-
cr.getAMethodCall("on") = mcn and
808+
cr.getAMethodCall(EventEmitter::on()) = mcn and
809809
mcn.getArgument(0).mayHaveStringValue("data") and
810810
this = mcn.getCallback(1).getParameter(0)
811811
)

javascript/ql/src/semmle/javascript/security/dataflow/ZipSlipCustomizations.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ module ZipSlip {
7070
// the expression `entry.path`.
7171
UnzipEntrySource() {
7272
exists(DataFlow::CallNode cn |
73-
cn = parsedArchive().getAMemberCall("on") and
73+
cn = parsedArchive().getAMemberCall(EventEmitter::on()) and
7474
cn.getArgument(0).mayHaveStringValue("entry") and
7575
this = cn.getCallback(1).getParameter(0).getAPropertyRead(getAFilenameProperty())
7676
)

0 commit comments

Comments
 (0)