Regex with optional capture groups might cause catastrophic backtracking (#2490)
* fix catastrophic backtracking * prevented catasthropic backtracing Co-authored-by: David Moškoř <david.moskor@apertia.cz>
This commit is contained in:
@@ -215,8 +215,7 @@ class ErrorOutput
|
||||
|
||||
private function clearPasswords(string $string): string
|
||||
{
|
||||
/** @var string */
|
||||
return preg_replace('/"(.*?password.*?)":".*?"/i', '"$1":"*****"', $string);
|
||||
return preg_replace('/"(.*password.*)":".*"/i', '"$1":"*****"', $string) ?? $string;
|
||||
}
|
||||
|
||||
private static function generateErrorBody(string $header, string $text): string
|
||||
|
||||
Reference in New Issue
Block a user