mirror of
https://github.com/github/codeql.git
synced 2025-12-20 18:56:32 +01:00
30 lines
913 B
Plaintext
30 lines
913 B
Plaintext
import java
|
|
import TestUtilities.InlineExpectationsTest
|
|
import semmle.code.java.security.performance.ExponentialBackTracking
|
|
import semmle.code.java.regex.regex
|
|
|
|
class HasExpRedos extends InlineExpectationsTest {
|
|
HasExpRedos() { this = "HasExpRedos" }
|
|
|
|
override string getARelevantTag() { result = ["hasExpRedos", "hasParseFailure"] }
|
|
|
|
override predicate hasActualResult(Location location, string element, string tag, string value) {
|
|
tag = "hasExpRedos" and
|
|
exists(RegExpTerm t, string pump, State s, string prefixMsg |
|
|
hasReDoSResult(t, pump, s, prefixMsg) and
|
|
not t.getRegex().getAMode() = "VERBOSE" and
|
|
value = "" and
|
|
location = t.getLocation() and
|
|
element = t.toString()
|
|
)
|
|
or
|
|
tag = "hasParseFailure" and
|
|
exists(Regex r |
|
|
r.failedToParse(_) and
|
|
value = "" and
|
|
location = r.getLocation() and
|
|
element = r.toString()
|
|
)
|
|
}
|
|
}
|