Pydantic AI fixes memory exhaustion vulnerability in local web scraping tool, fixed in 1.107.10 and 2.66.0
Pydantic AI fixed a memory exhaustion vulnerability in its local web scraping tool; pydantic-ai and pydantic-ai-slim versions 1.77.0 to 1.107.9 were fixed in 1.107.10, and versions 2.0.0b1 to 2.65.0 were fixed in 2.66.0. The tool re-indents the JSON response before the application returns the content length limit, and this step runs on the event loop; the indented output grows with nesting depth, so deeply nested documents within the download size limit can expand to hundreds of times their original size, consuming large amounts of memory and slowing other tasks in the same process. The vulnerability affects applications that use web_fetch_tool or the local fallback of the WebFetch capability and whose URLs can be chosen or influenced by an attacker; vendor-native web scraping is not affected. Before upgrading, allowed_domains can be used to restrict local scraping to trusted hosts, or native web scraping can be used instead.
The advisory breaks down the unconstrained formatting step between the download limit and the returned content limit, which teams using local web scraping can use to assess domain restrictions.