mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Python: track if qualifiers allow unbounded
repeats. This in preparation for ReDoS
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
| (?!not-this)^[A-Z_]+$ | 13 | 20 | false |
|
||||
| (?:(?:\n\r?)\|^)( *)\\S | 7 | 9 | true |
|
||||
| (?:(?:\n\r?)\|^)( *)\\S | 14 | 16 | true |
|
||||
| (?:[^%]\|^)?%\\((\\w*)\\)[a-z] | 0 | 11 | true |
|
||||
| (?:[^%]\|^)?%\\((\\w*)\\)[a-z] | 15 | 18 | true |
|
||||
| (?P<name>[\\w]+)\| | 9 | 14 | false |
|
||||
| \\A[+-]?\\d+ | 2 | 7 | true |
|
||||
| \\A[+-]?\\d+ | 7 | 10 | false |
|
||||
| \\[(?P<txt>[^[]*)\\]\\((?P<uri>[^)]*) | 10 | 15 | true |
|
||||
| \\[(?P<txt>[^[]*)\\]\\((?P<uri>[^)]*) | 28 | 33 | true |
|
||||
| ^[A-Z_]+$(?<!not-this) | 1 | 8 | false |
|
||||
| ax{01,3} | 1 | 8 | false |
|
||||
| ax{3,} | 1 | 6 | false |
|
||||
| ax{3} | 1 | 5 | false |
|
||||
| ax{,3} | 1 | 6 | true |
|
||||
| (?!not-this)^[A-Z_]+$ | 13 | 20 | false | true |
|
||||
| (?:(?:\n\r?)\|^)( *)\\S | 7 | 9 | true | false |
|
||||
| (?:(?:\n\r?)\|^)( *)\\S | 14 | 16 | true | true |
|
||||
| (?:[^%]\|^)?%\\((\\w*)\\)[a-z] | 0 | 11 | true | false |
|
||||
| (?:[^%]\|^)?%\\((\\w*)\\)[a-z] | 15 | 18 | true | true |
|
||||
| (?P<name>[\\w]+)\| | 9 | 14 | false | true |
|
||||
| \\A[+-]?\\d+ | 2 | 7 | true | false |
|
||||
| \\A[+-]?\\d+ | 7 | 10 | false | true |
|
||||
| \\[(?P<txt>[^[]*)\\]\\((?P<uri>[^)]*) | 10 | 15 | true | true |
|
||||
| \\[(?P<txt>[^[]*)\\]\\((?P<uri>[^)]*) | 28 | 33 | true | true |
|
||||
| ^[A-Z_]+$(?<!not-this) | 1 | 8 | false | true |
|
||||
| ax{01,3} | 1 | 8 | false | false |
|
||||
| ax{3,} | 1 | 6 | false | true |
|
||||
| ax{3} | 1 | 5 | false | false |
|
||||
| ax{,3} | 1 | 6 | true | false |
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import python
|
||||
import semmle.python.regex
|
||||
|
||||
from Regex r, int start, int end, boolean maybe_empty
|
||||
where r.qualifiedItem(start, end, maybe_empty)
|
||||
select r.getText(), start, end, maybe_empty
|
||||
from Regex r, int start, int end, boolean maybe_empty, boolean may_repeat_forever
|
||||
where r.qualifiedItem(start, end, maybe_empty, may_repeat_forever)
|
||||
select r.getText(), start, end, maybe_empty, may_repeat_forever
|
||||
|
||||
@@ -16,7 +16,7 @@ predicate part(Regex r, int start, int end, string kind) {
|
||||
or
|
||||
r.group(start, end) and not r.zeroWidthMatch(start, end) and kind = "non-empty group"
|
||||
or
|
||||
r.qualifiedItem(start, end, _) and kind = "qualified"
|
||||
r.qualifiedItem(start, end, _, _) and kind = "qualified"
|
||||
}
|
||||
|
||||
from Regex r, int start, int end, string kind
|
||||
|
||||
Reference in New Issue
Block a user