PydanticAI v2.30.0 发布:修复 DNS 重绑定漏洞并新增 Gemini 3.7 Flash 支持
原标题:v2.30.0 (2026-08-13)
AI 摘要
PydanticAI 发布 v2.30.0 版本,修复了本地开发 Web 聊天界面(Agent.to_web() 和 clai web)的 DNS 重绑定安全漏洞,通过默认验证 Host 头为 localhost/loopback/LAN 地址,并新增 allowed_hosts 设置供真实域名部署时使用。新功能包括支持 OpenRouter 的 web_search、新增 gemini-3.7-flash 模型、在 XaiProvider 上暴露 gRPC metadata,以及多项 bug 修复。
正文节选
<!-- Release notes generated using configuration in .github/release.yml at main --> ## What's Changed ### 🛡️ Security * [GHSA-q2xc-rrxj-58x9](https://github.com/pydantic/pydantic-ai/security/advisories/GHSA-q2xc-rrxj-58x9): the local dev web chat UI (`Agent.to_web()`, `clai web`) didn't validate the `Host` header, so DNS rebinding from a website you visit could reach it and run the served agent with your local process's tools and credentials. Fixed in `pydantic-ai`/`pydantic-ai-slim` 2.30.0 by