The report
A guardrail can consume enough CPU to block other agents before it produces a safety decision. Pydantic AI Harness maintainers published two distinct security advisories on November 18, both describing quadratic regular-expression work inside pydantic-ai-harness. In applications using affected paths, several hundred kilobytes of crafted input or tool output could occupy a shared event loop for tens of seconds or minutes.
Two entry points, one shared availability risk
The first flaw arises in ToolOutputLimits when the optional strip_ansi=True option removes escape sequences from tool output. The expensive work occurs before the output-length limiter, so the presence of a truncation policy does not bound the regular expression's execution time. The advisory lists affected versions from 0.4.0 through 0.69.0, and recommends disabling optional ANSI stripping until the fix is installed.
The second flaw concerns the default JWT-pattern detector used by redact_secrets or secret_data() in input, tool and output guardrails. An attacker-influenced prompt or tool response could drive the pattern into quadratic processing. Its affected range begins at 0.16.0 and ends at 0.69.0. Omitting the JWT detector in an older installation could avoid this processing path but would also reduce secret-redaction coverage, so that workaround needs an explicit confidentiality trade-off.
| Separate issue | Entry condition | Affected released range |
|---|---|---|
| ANSI stripping | Optional strip_ansi=True on tool output |
0.4.0 to 0.69.0 |
| JWT redaction | JWT pattern in secret redaction guard | 0.16.0 to 0.69.0 |
Why a guardrail has to be bounded itself
Both defects are reported fixed in 0.70.0. The ANSI advisory additionally notes that Pydantic AI v1 users can be constrained by an older harness dependency and may need to upgrade to v2 or leave ANSI stripping disabled. The public advisories describe reachable denial-of-service paths, not a measured wave of production outages.
A shared event-loop service must bound preprocessing cost before it invokes transformations on untrusted text. Relying only on the final token or character limit can leave the expensive part outside the limit, while removing secret detection altogether may create a new information-handling exposure.