Check the input and the engine#
OWASP describes the attack as exploiting the fact "that most Regular Expression implementations may reach extreme situations that cause them to work very slowly (exponentially related to input size)." It names two routes: a vulnerable pattern applied to attacker-supplied text, and a pattern that is itself built from user input. OWASP ReDoS A comment that names neither route describes, at most, a slow regex.
The engine matters as much as the pattern. Go's regexp package documents that its matching runs in time linear in the size of the input. Go regexp Python's re, Java's java.util.regex and JavaScript's RegExp backtrack, so nested or overlapping quantifiers can cost exponential time on input that almost matches. Two backtracking engines can still differ on the same pattern, which is why the measurement has to use the library the code imports.
A tool-call regex that slowed in one engine#
In April 2026, a vLLM pull request added a tool-call parser for LFM2 models. Gemini Code Assist's summary said: "A high-severity security issue was identified regarding the TOOL_CALL_REGEX, which is vulnerable to Regular Expression Denial of Service (ReDoS) due to complex nested quantifiers." It added: "It is recommended to simplify this regex, as the code already performs robust validation using ast.parse." Review
The pattern, before the change, nested repeated groups that each contain .*:
TOOL_CALL_REGEX = re.compile(
r"\[([a-zA-Z]+\w*\(([a-zA-Z]+\w*=.*,\s*)*([a-zA-Z]+\w*=.*\s)?\)"
r",\s*)*([a-zA-Z]+\w*\(([a-zA-Z]+\w*=.*,\s*)*"
r"([a-zA-Z]+\w*=.*\s*)?\)\s*)+\]",
re.DOTALL,
)
The input is model output, which a user's prompt can steer, so treat it as attacker-influenced. For this guide, the pattern was timed on a call that opens and never closes: [f( followed by a=1, repeated n times. With Python's standard re, two runs took roughly 24 to 30 ms at n = 16, 95 to 123 ms at n = 18 and 421 to 614 ms at n = 20, three to six times longer for every two more repetitions. But the parser imports the third-party regex module (import regex as re), not the standard library. In regex 2026.11.19, the same inputs finished in under 0.1 ms, and a one-minute random search over call-like fragments found nothing slower than 7.3 ms. That search does not prove no slow input exists. The call also already passed timeout=envs.VLLM_TOOL_PARSE_REGEX_TIMEOUT_SECONDS, which defaults to one second.
So the comment was right about the pattern's shape and overstated the risk in the shipped engine. The author changed it anyway, in commit a51d3d2, "fix: change tool call regex to be a simple structural check", to re.compile(r"\[.*\]$", re.DOTALL), and left the real validation to ast.parse. Commits The pull request merged on 8 May 2026. When a simpler pattern does the same job, replacing it costs less than proving the old one safe in every engine it might meet.
A pattern built from constants#
An ArcadeDB pull request from October 2026 records the opposite outcome. It extended a redactor for support diagnostics so passwords inside the defaultDatabases setting are masked. The author's description lists each review round: "CodeRabbit raised one valid Major finding", fixed with a test, and "Its ast-grep ReDoS note was not applicable: the pattern is built from constants only and uses possessive quantifiers." Pull request The note itself is not visible on the page; the description is the record of it.
Both halves of that reason are checkable. Every piece the pattern is built from is a private static final String in the class, so no input reaches the pattern. The input text is log and configuration content, which can be long, and the pattern's quantifiers are possessive (*+, ++), which keep what they match and never give characters back to let the rest of the pattern retry. Java Pattern On OpenJDK 21, the merged DEFAULT_DATABASES pattern matched a line of 100,000 repeated a[u:p] ; entries, about 900,000 characters, in 16 to 17 ms. A copy with the possessive quantifiers changed to greedy ones threw StackOverflowError at 1,000 entries, the failure a code comment in the same class warns about for long quoted values. The dismissal holds. The pull request merged on 10 October 2026.
Decide from the input and the measurement#
| Input and engine | Evidence to check | Response |
|---|---|---|
| Pattern built from user input | Where the pattern string comes from | Change: escape the input, or use a linear-time engine |
| Attacker-reachable text, backtracking engine, nested or overlapping quantifiers | Time on growing near-miss inputs in the imported library | Change the pattern, or bound input length and match time |
| Same, but the timing stays flat | The measurement, with the library version | Dismiss with the numbers, or simplify if it is cheap |
| Constant pattern with possessive or atomic groups | The constants and a long-input timing | Dismiss, citing both |
Linear-time engine, such as Go's regexp | The import | Dismiss, naming the engine |
| Input only from trusted configuration | Who writes that configuration | Dismiss with the trust boundary |
Keep the timing script with the reply, since the next person to change the pattern will need it. If the reviewer repeats the note on every push, the guide to findings your linter already covers explains how to sort rule-based notes from a reviewer's own findings.