File tree Expand file tree Collapse file tree
swift/ql/test/library-tests/regex Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import swift
22import codeql.swift.regex.Regex
3+ private import codeql.swift.regex.RegexTreeView:: RegexTreeView as TreeView
4+ import codeql.regex.nfa.ExponentialBackTracking:: Make< TreeView >
35import TestUtilities.InlineExpectationsTest
46
57bindingset [ s]
68string quote ( string s ) { if s .matches ( "% %" ) then result = "\"" + s + "\"" else result = s }
79
810module RegexTest implements TestSig {
9- string getARelevantTag ( ) { result = [ "regex" , "input" ] }
11+ string getARelevantTag ( ) { result = [ "regex" , "input" , "redos-vulnerable" ] }
1012
1113 predicate hasActualResult ( Location location , string element , string tag , string value ) {
1214 exists ( RegexEval eval , Expr regex |
@@ -24,6 +26,14 @@ module RegexTest implements TestSig {
2426 tag = "input" and
2527 value = quote ( input .toString ( ) )
2628 )
29+ or
30+ exists ( TreeView:: RegExpTerm t , string pump , State s , string prefixMsg |
31+ hasReDoSResult ( t , pump , s , prefixMsg ) and
32+ location = t .getLocation ( ) and
33+ element = t .toString ( ) and
34+ tag = "redos-vulnerable" and
35+ value = ""
36+ )
2737 }
2838}
2939
You can’t perform that action at this time.
0 commit comments