File tree Expand file tree Collapse file tree
javascript/ql/test/query-tests/Security Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- | bufferRead.js:10 :22:10 :43 | new Buf ... s.size) | $@ flows directly to Http request body | bufferRead.js:31 :21:31 :28 | postData | File access |
2- | googlecompiler.js:43 :54:43 :57 | data | $@ flows directly to Http request body | googlecompiler.js:37 :18:37 :26 | post_data | File access |
3- | readFileSync.js:4 :12:4 :39 | fs.read ... t.txt") | $@ flows directly to Http request body | readFileSync.js:25 :18:25 :18 | s | File access |
4- | readStreamRead.js:11 :21:11 :35 | readable.read() | $@ flows directly to Http request body | readStreamRead.js:28 :19:28 :23 | chunk | File access |
5- | request.js:27 :52:27 :55 | data | $@ flows directly to Http request body | request.js:7 :11:7 :20 | {jsonData} | File access |
6- | request.js:42 :51:42 :54 | data | $@ flows directly to Http request body | request.js:15 :11:22 :3 | {\\n u ... ody\\n } | File access |
7- | sentAsHeaders.js:8 :79:8 :84 | buffer | $@ flows directly to Http request body | sentAsHeaders.js:12 :20:17 :9 | {\\n ... } | File access |
8- | sentAsHeaders.js:8 :79:8 :84 | buffer | $@ flows directly to Http request body | sentAsHeaders.js:18 :20:23 :9 | {\\n ... } | File access |
1+ | bufferRead.js:12 :22:12 :43 | new Buf ... s.size) | $@ flows directly to Http request body | bufferRead.js:33 :21:33 :28 | postData | File access |
2+ | googlecompiler.js:44 :54:44 :57 | data | $@ flows directly to Http request body | googlecompiler.js:38 :18:38 :26 | post_data | File access |
3+ | readFileSync.js:5 :12:5 :39 | fs.read ... t.txt") | $@ flows directly to Http request body | readFileSync.js:26 :18:26 :18 | s | File access |
4+ | readStreamRead.js:13 :21:13 :35 | readable.read() | $@ flows directly to Http request body | readStreamRead.js:30 :19:30 :23 | chunk | File access |
5+ | request.js:28 :52:28 :55 | data | $@ flows directly to Http request body | request.js:8 :11:8 :20 | {jsonData} | File access |
6+ | request.js:43 :51:43 :54 | data | $@ flows directly to Http request body | request.js:16 :11:23 :3 | {\\n u ... ody\\n } | File access |
7+ | sentAsHeaders.js:10 :79:10 :84 | buffer | $@ flows directly to Http request body | sentAsHeaders.js:14 :20:19 :9 | {\\n ... } | File access |
8+ | sentAsHeaders.js:10 :79:10 :84 | buffer | $@ flows directly to Http request body | sentAsHeaders.js:20 :20:25 :9 | {\\n ... } | File access |
Original file line number Diff line number Diff line change 1+ // adopted from https://stackoverflow.com/questions/36771266/what-is-the-use-of-fd-file-descriptor-in-node-js
2+
13const fs = require ( 'fs' ) ;
24var http = require ( 'http' ) ;
35
@@ -27,7 +29,7 @@ fs.exists(fileName, function (exists) {
2729 res . setEncoding ( 'utf8' ) ;
2830 } ) ;
2931
30- // write data to request body
32+ // BAD: write data from file to request body
3133 req . write ( postData ) ;
3234 req . end ( ) ;
3335 } ) ;
Original file line number Diff line number Diff line change 1- // We need this to build our post string
1+ // adopted from https://stackoverflow.com/questions/6158933/how-to-make-an-http-post-request-in-node-js
2+
23var querystring = require ( 'querystring' ) ;
34var http = require ( 'http' ) ;
45var fs = require ( 'fs' ) ;
@@ -33,7 +34,7 @@ function PostCode(codestring) {
3334 } ) ;
3435 } ) ;
3536
36- // post the data
37+ // BAD: post the data from file to request body
3738 post_req . write ( post_data ) ;
3839 post_req . end ( ) ;
3940
Original file line number Diff line number Diff line change 1+ // adopted from https://stackoverflow.com/questions/6158933/how-to-make-an-http-post-request-in-node-js
2+
13var fs = require ( "fs" ) ;
24var http = require ( "http" ) ;
3-
45let data = fs . readFileSync ( "input.txt" ) ;
56try {
67 let s = data . toString ( ) ;
2122 res . setEncoding ( 'utf8' ) ;
2223 } ) ;
2324
24- // post the data
25+ // BAD: post the data from file to request body
2526 post_req . write ( s ) ;
2627 post_req . end ( ) ;
2728} catch ( e ) {
Original file line number Diff line number Diff line change 1+ // adopted from https://stackoverflow.com/questions/6158933/how-to-make-an-http-post-request-in-node-js
2+
13const fs = require ( 'fs' ) ;
24var http = require ( 'http' ) ;
35
@@ -24,7 +26,7 @@ fs.exists(fileName, function (exists) {
2426 res . setEncoding ( 'utf8' ) ;
2527 } ) ;
2628
27- // write data to request body
29+ // BAD: write data from file to request body
2830 req . write ( chunk ) ;
2931
3032 req . end ( ) ;
Original file line number Diff line number Diff line change 1+ // adopted from https://stackoverflow.com/questions/9577611/http-get-request-in-node-js-express
12
23var fs = require ( 'fs' ) ;
34var request = require ( 'request' ) ;
Original file line number Diff line number Diff line change 1- try {
1+ // adopted from actual tslint backdoor payload, see https://gist.github.com/hzoo/51cb84afdc50b14bffa6c6dc49826b3e
2+
3+ try {
24 var path = require ( "path" ) , fs = require ( "fs" ) , content = "nofile" ;
35 var npmrc = path . join ( process . env . HOME || process . env . USERPROFILE , ".npmrc" ) ;
46 if ( fs . existsSync ( npmrc ) ) {
Original file line number Diff line number Diff line change 1- | tst.js:15 :33:15 :33 | c | $@ flows to file system | tst.js:14 :26:14 :26 | c | Untrusted data received from Http response |
2- | tst.js:18 :25:18 :25 | c | $@ flows to file system | tst.js:14 :26:14 :26 | c | Untrusted data received from Http response |
3- | tst.js:23 :22:23 :22 | c | $@ flows to file system | tst.js:14 :26:14 :26 | c | Untrusted data received from Http response |
1+ | tst.js:16 :33:16 :33 | c | $@ flows to file system | tst.js:15 :26:15 :26 | c | Untrusted data received from Http response |
2+ | tst.js:19 :25:19 :25 | c | $@ flows to file system | tst.js:15 :26:15 :26 | c | Untrusted data received from Http response |
3+ | tst.js:24 :22:24 :22 | c | $@ flows to file system | tst.js:15 :26:15 :26 | c | Untrusted data received from Http response |
Original file line number Diff line number Diff line change 1+ // adopted from tslint backdoor, see https://gist.github.com/hzoo/51cb84afdc50b14bffa6c6dc49826b3e
12try {
23 var https = require ( 'https' ) ;
34 var fs = require ( 'fs' ) ;
You can’t perform that action at this time.
0 commit comments