File tree Expand file tree Collapse file tree
src/semmle/javascript/frameworks
test/library-tests/frameworks/SocketIO Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -526,3 +526,39 @@ private module EventEmitter {
526526 result = "prependOnceListener"
527527 }
528528}
529+
530+ /** A data flow step through socket.io sockets. */
531+ private class SocketIoStep extends DataFlow:: AdditionalFlowStep {
532+ DataFlow:: Node pred ;
533+
534+ DataFlow:: Node succ ;
535+
536+ SocketIoStep ( ) {
537+ (
538+ exists ( SocketIO:: SendNode send , SocketIOClient:: ReceiveNode recv , int i |
539+ recv = send .getAReceiver ( )
540+ |
541+ pred = send .getSentItem ( i ) and
542+ succ = recv .getReceivedItem ( i )
543+ or
544+ pred = recv .getAck ( ) .getACall ( ) .getArgument ( i ) and
545+ succ = send .getAck ( ) .getParameter ( i )
546+ )
547+ or
548+ exists ( SocketIOClient:: SendNode send , SocketIO:: ReceiveNode recv , int i |
549+ recv = send .getAReceiver ( )
550+ |
551+ pred = send .getSentItem ( i ) and
552+ succ = recv .getReceivedItem ( i )
553+ or
554+ pred = recv .getAck ( ) .getACall ( ) .getArgument ( i ) and
555+ succ = send .getAck ( ) .getParameter ( i )
556+ )
557+ ) and
558+ this = pred
559+ }
560+
561+ override predicate step ( DataFlow:: Node predNode , DataFlow:: Node succNode ) {
562+ predNode = pred and succNode = succ
563+ }
564+ }
Original file line number Diff line number Diff line change 1+ | client2.js:16:12:16:25 | "do you copy?" | tst.js:70:25:70:27 | msg |
2+ | client2.js:16:12:16:25 | "do you copy?" | tst.js:71:27:71:31 | data1 |
3+ | client3.js:1:8:1:9 | io | client3.js:1:8:1:9 | io |
4+ | tst.js:30:18:30:27 | 'an event' | client2.js:8:23:8:25 | msg |
5+ | tst.js:30:18:30:27 | 'an event' | client2.js:10:19:10:19 | x |
6+ | tst.js:31:9:31:19 | 'a message' | client2.js:4:21:4:21 | x |
7+ | tst.js:31:9:31:19 | 'a message' | client2.js:8:23:8:25 | msg |
8+ | tst.js:32:11:32:21 | 'a message' | client2.js:18:22:18:22 | x |
9+ | tst.js:39:20:39:30 | 'a message' | client2.js:4:21:4:21 | x |
10+ | tst.js:39:20:39:30 | 'a message' | client2.js:8:23:8:25 | msg |
11+ | tst.js:40:9:40:19 | 'a message' | client2.js:4:21:4:21 | x |
12+ | tst.js:40:9:40:19 | 'a message' | client2.js:8:23:8:25 | msg |
13+ | tst.js:41:10:41:20 | 'a message' | client2.js:4:21:4:21 | x |
14+ | tst.js:41:10:41:20 | 'a message' | client2.js:8:23:8:25 | msg |
15+ | tst.js:54:15:54:17 | 'a' | client2.js:4:21:4:21 | x |
16+ | tst.js:54:15:54:17 | 'a' | client2.js:8:23:8:25 | msg |
17+ | tst.js:54:20:54:28 | 'message' | client2.js:4:24:4:24 | y |
18+ | tst.js:55:16:55:26 | 'a message' | client2.js:4:21:4:21 | x |
19+ | tst.js:55:16:55:26 | 'a message' | client2.js:8:23:8:25 | msg |
Original file line number Diff line number Diff line change 1+ import javascript
2+
3+ from DataFlow:: AdditionalFlowStep step , DataFlow:: Node pred , DataFlow:: Node succ
4+ where step .step ( pred , succ )
5+ select pred , succ
You can’t perform that action at this time.
0 commit comments