Skip to content

Commit d497890

Browse files
committed
JS: Use SendCallback/ReceiveCallback in getAck
1 parent 6792599 commit d497890

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

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

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,8 @@ module SocketIO {
283283
SendNode getASender() { result.getAReceiver() = this }
284284

285285
/** Gets the acknowledgment callback, if any. */
286-
DataFlow::SourceNode getAck() {
287-
result.(ReceiveCallback).getReceiveNode() = this
286+
ReceiveCallback getAck() {
287+
result.getReceiveNode() = this
288288
}
289289

290290
/** DEPRECATED. Use `getChannel()` instead. */
@@ -374,10 +374,8 @@ module SocketIO {
374374
}
375375

376376
/** Gets the acknowledgment callback, if any. */
377-
DataFlow::FunctionNode getAck() {
378-
// acknowledgments are only available when sending through a socket
379-
exists(getSocket()) and
380-
result = getLastArgument().getALocalSource()
377+
SendCallback getAck() {
378+
result.getSendNode() =this
381379
}
382380

383381
/** DEPRECATED. Use `getChannel()` instead. */
@@ -576,8 +574,7 @@ module SocketIOClient {
576574

577575
/** Gets the acknowledgment callback, if any. */
578576
DataFlow::SourceNode getAck() {
579-
result = getListener().getLastParameter() and
580-
exists(result.getAnInvocation())
577+
result.(ReceiveCallback).getReceiveNode() = this
581578
}
582579

583580
/** Gets a server-side node that may be sending the data received here. */
@@ -664,9 +661,7 @@ module SocketIOClient {
664661

665662
/** Gets the acknowledgment callback, if any. */
666663
DataFlow::FunctionNode getAck() {
667-
// acknowledgments are only available when sending through a socket
668-
exists(getSocket()) and
669-
result = getLastArgument().getALocalSource()
664+
result.(SendCallback).getSendNode() = this
670665
}
671666

672667
/** DEPRECATED. Use `getChannel()` instead. */

0 commit comments

Comments
 (0)