A regular expression that takes super-linear time is matched against request input
What it finds
A pattern that takes exponential or polynomial time, as the two rules above find, matched against request input ($_GET, $_POST, the request objects of the frameworks), as regex-from-request follows it.
From the rule's source, regex_backtracking.rs.
<?phpfunction check(){ return preg_match('/^(\w+\s?)*$/', $_GET['name']);tx0 reports: request input from} Turn it on, off or suppress it
The rule runs from the all tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/php:regex-backtracking-on-input" = "error"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/php:regex-backtracking-on-input] reason="..."tx0 explain tx0/php:regex-backtracking-on-input shows the same in the terminal. Found a false positive? Report it.