File tree Expand file tree Collapse file tree
swift/ql/src/queries/Security/CWE-1333 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /**
2+ * @name Inefficient regular expression
3+ * @description A regular expression that requires exponential time to match certain inputs
4+ * can be a performance bottleneck, and may be vulnerable to denial-of-service
5+ * attacks.
6+ * @kind problem
7+ * @problem.severity error
8+ * @security-severity 7.5
9+ * @precision high
10+ * @id rb/redos
11+ * @tags security
12+ * external/cwe/cwe-1333
13+ * external/cwe/cwe-730
14+ * external/cwe/cwe-400
15+ */
16+
17+ private import codeql.ruby.regexp.RegExpTreeView:: RegexTreeView as TreeView
18+ import codeql.regex.nfa.ExponentialBackTracking:: Make< TreeView >
19+
20+ from TreeView:: RegExpTerm t , string pump , State s , string prefixMsg
21+ where hasReDoSResult ( t , pump , s , prefixMsg )
22+ select t ,
23+ "This part of the regular expression may cause exponential backtracking on strings " + prefixMsg +
24+ "containing many repetitions of '" + pump + "'."
You can’t perform that action at this time.
0 commit comments