This commit is contained in:
lorenzejay
2026-02-11 20:45:40 -08:00
parent ec2b6a0287
commit 925ed7850e

View File

@@ -262,7 +262,9 @@ class GrepTool(BaseTool):
return sorted(files)
@staticmethod
def _safe_search(compiled_pattern: re.Pattern[str], line: str) -> re.Match[str] | None:
def _safe_search(
compiled_pattern: re.Pattern[str], line: str
) -> re.Match[str] | None:
"""Run a regex search with a per-line timeout to mitigate ReDoS.
On platforms that support SIGALRM (Unix), a timeout is enforced.