mirror of
https://github.com/github/codeql.git
synced 2026-04-26 01:05:15 +02:00
JS: Sharpen up EnumerationRegExp
This commit is contained in:
@@ -140,22 +140,17 @@ module MembershipCandidate {
|
||||
EnumerationRegExp() {
|
||||
this.isRootTerm() and
|
||||
RegExp::isFullyAnchoredTerm(this) and
|
||||
exists(RegExpTerm child | this.getAChild*() = child |
|
||||
child instanceof RegExpSequence or
|
||||
child instanceof RegExpCaret or
|
||||
child instanceof RegExpDollar or
|
||||
child instanceof RegExpConstant or
|
||||
child instanceof RegExpAlt or
|
||||
child instanceof RegExpGroup
|
||||
) and
|
||||
// exclude "length matches" that match every string
|
||||
not this.getAChild*() instanceof RegExpDot
|
||||
not exists(RegExpTerm child | child.getRootTerm() = this |
|
||||
child instanceof RegExpDot or
|
||||
child instanceof RegExpCharacterClass or
|
||||
child instanceof RegExpUnicodePropertyEscape
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a string matched by this regular expression.
|
||||
*/
|
||||
string getAMember() { result = this.getAChild*().getAMatchedString() }
|
||||
string getAMember() { result = any(RegExpTerm t | t.getRootTerm() = this).getAMatchedString() }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -238,6 +238,7 @@ flow
|
||||
| promise.js:18:22:18:29 | source() | promise.js:24:10:24:10 | e |
|
||||
| promise.js:33:21:33:28 | source() | promise.js:38:10:38:10 | e |
|
||||
| promise.js:43:20:43:27 | source() | promise.js:43:8:43:28 | Promise ... urce()) |
|
||||
| regexp-sanitiser.js:2:19:2:26 | source() | regexp-sanitiser.js:4:14:4:18 | taint |
|
||||
| rxjs.js:3:1:3:8 | source() | rxjs.js:10:14:10:17 | data |
|
||||
| rxjs.js:13:1:13:8 | source() | rxjs.js:17:23:17:23 | x |
|
||||
| rxjs.js:13:1:13:8 | source() | rxjs.js:18:23:18:23 | x |
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
function foo() {
|
||||
const taint = source();
|
||||
if (/^asd[\s\S]*$/.test(taint)) {
|
||||
sink(taint); // NOT OK [INCONSISTENCY]
|
||||
sink(taint); // NOT OK
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user