Skip to content

Commit 622a2fc

Browse files
committed
use regexp term instead of char class
1 parent 53d1cd3 commit 622a2fc

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

javascript/ql/src/semmle/javascript/security/dataflow/TaintedPathCustomizations.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,9 @@ module TaintedPath {
227227
seq.getNumChild() = 2
228228
)
229229
or
230-
exists(RegExpCharacterClass choice | literal.getRoot() = choice |
231-
choice.getAMatchedString() = "/" or
232-
choice.getAMatchedString() = "."
230+
exists(RegExpTerm term | literal.getRoot() = term |
231+
term.getAMatchedString() = "/" or
232+
term.getAMatchedString() = "."
233233
)
234234
)
235235
}

javascript/ql/test/query-tests/Security/CWE-022/TaintedPath/TaintedPath.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,4 +179,6 @@ var server = http.createServer(function(req, res) {
179179
res.write(fs.readFileSync(path.replace(/[..]/g, ''))); // OK
180180
res.write(fs.readFileSync(path.replace(/[./]/g, ''))); // OK
181181
res.write(fs.readFileSync(path.replace(/[foobar/foobar]/g, ''))); // OK
182+
res.write(fs.readFileSync(path.replace(/\//g, ''))); // OK
183+
res.write(fs.readFileSync(path.replace(/\./g, ''))); // OK
182184
});

0 commit comments

Comments
 (0)