Skip to content

Commit 14999c1

Browse files
committed
Added test cases for rimraf library.
1 parent 01275aa commit 14999c1

File tree

1 file changed

+30
-0
lines changed
  • javascript/ql/test/query-tests/Security/CWE-022/TaintedPath

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
const express = require('express');
2+
const rimraf = require('rimraf');
3+
4+
const app = express();
5+
app.use(express.json());
6+
7+
app.post('/rmsync', async (req, res) => {
8+
const { path } = req.body; // $ MISSING: Source
9+
10+
rimraf.sync(path); // $ MISSING: Alert
11+
rimraf.rimrafSync(path); // $ MISSING: Alert
12+
rimraf.native(path); // $ MISSING: Alert
13+
await rimraf.native(path); // $ MISSING: Alert
14+
rimraf.native.sync(path); // $ MISSING: Alert
15+
rimraf.nativeSync(path); // $ MISSING: Alert
16+
await rimraf.manual(path); // $ MISSING: Alert
17+
rimraf.manual(path); // $ MISSING: Alert
18+
rimraf.manual.sync(path); // $ MISSING: Alert
19+
rimraf.manualSync(path); // $ MISSING: Alert
20+
await rimraf.windows(path); // $ MISSING: Alert
21+
rimraf.windows(path); // $ MISSING: Alert
22+
rimraf.windows.sync(path); // $ MISSING: Alert
23+
rimraf.windowsSync(path); // $ MISSING: Alert
24+
rimraf.moveRemove(path); // $ MISSING: Alert
25+
rimraf.moveRemove.sync(path); // $ MISSING: Alert
26+
rimraf.moveRemoveSync(path); // $ MISSING: Alert
27+
rimraf.posixSync(path); // $ MISSING: Alert
28+
rimraf.posix(path); // $ MISSING: Alert
29+
rimraf.posix.sync(path); // $ MISSING: Alert
30+
});

0 commit comments

Comments
 (0)