Skip to content

Commit e74e5b3

Browse files
committed
try to restrict the edges we follow (related to upper/lower-case) when contructing possible attack-strings for polynomial-redos
1 parent 95ce0cd commit e74e5b3

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

shared/regex/codeql/regex/nfa/SuperlinearBackTracking.qll

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,11 +365,19 @@ module Make<RegexTreeViewSig TreeImpl> {
365365
)
366366
}
367367

368-
string getChar(CharNode t) {
368+
private string getCharInternal(CharNode t) {
369369
exists(InputSymbol s1, InputSymbol s2, InputSymbol s3 | t = Step(s1, s2, s3, _) |
370370
result = getAThreewayIntersect(s1, s2, s3)
371371
)
372372
}
373+
374+
string getChar(CharNode t) {
375+
result = getCharInternal(t) and
376+
not (
377+
// skip the upper-case char if we have the lower-case version.
378+
result.toLowerCase() != result and result.toLowerCase() = getCharInternal(t)
379+
)
380+
}
373381
}
374382

375383
/**

0 commit comments

Comments
 (0)