Skip to content
Pydantic AI·Indexed by this site · Originally published· Event →· Its place in the scan record →SelectedAttention37

Pydantic AI Harness ANSI stripping vulnerability fix

Harness ToolOutputLimits ANSI stripping can take quadratic time, blocking the event loop

AI summary

Pydantic AI's Harness performs ANSI stripping on tool output when strip_ansi=True; the matching pattern used takes time that grows quadratically with line length, so a crafted tool result of a few hundred KB containing many unterminated escape sequences can occupy the event loop for tens of seconds to several minutes, slowing other requests and agent runs in the process. Affected versions are pydantic-ai-harness 0.4.0 to 0.69.0, fixed in 0.70.0. The trigger condition is that strip_ansi is enabled on ToolOutputLimits and the tool output can be influenced by an attacker, such as shell commands, file reads, fetched pages or MCP servers; stripping runs on the event loop before output reduction, so its own size limits cannot constrain it.

Why it was selected

The advisory gives the affected version range and the fixed version; teams using the output of this Harness processing tool can use this to check the strip_ansi setting and schedule an upgrade.

Read originalgithub.com