Pydantic AI fixes flaw that could expose MCP credentials in telemetry
Pydantic AI version 2.58.0 fixes two medium-severity security flaws. MCP credentials could end up in OpenTelemetry traces, and through the UI adapters the client side could make an agent run a tool even though the model had not requested it.
The Pydantic AI project released version 2.58.0 on 19 October. The release fixes two security flaws that the project rates as Medium. Pydantic AI is a Python library for building AI agents. This report is based on the project’s own release notes on GitHub.
The first flaw concerns MCP, the protocol that connects an agent to external tools and data sources through MCP servers. If an MCP server was configured through the model provider’s native MCP support, the server URL, authorisation tokens and custom header values could end up in OpenTelemetry traces. OpenTelemetry is an open standard that programs use to record the requests they make, for monitoring and debugging. The data could appear in traces even when content recording was switched off with include_content=False. In addition, if the MCP capability was based on a URL, a token embedded in that URL could appear in the identifier derived from it.
Versions 2.58.0 and 1.107.8 contain the fix. Updating alone is not enough, however: the project also advises users to restrict access to traces collected earlier and to rotate any exposed credentials.
For applications that use the Temporal workflow engine, the fix is only partial. The project left the names of URL-based MCP activities unchanged so that in-flight workflows are not disrupted. If Temporal tracing is enabled, the project advises giving MCP its own id= identifier only after in-flight workflows have finished, because changing the identifier changes the activity names.
The second flaw was in the Vercel AI and AG-UI adapters, which connect an agent to a web application’s user interface. When the server held stored message history and the system prompt was managed on the server (manage_system_prompt='server', the default), the client side could make the agent run an available tool with arguments of its own choosing, even though the model had not requested a tool call. Tools that require approval could not be run this way. Version 2.58.0 fixes the flaw, and the 1 series was not affected.
The new features include a time limit for an entire agent run, which developers can now set with the timeout= parameter. The request_timeout setting limits how long a single model request may take, including all retries and streaming, and max_retries sets how many times the model provider’s SDK retries a request. With the new openai-chatgpt provider, an application’s users can sign in with their ChatGPT account and use the quota of their own subscription.
The update may also break existing workflows. DBOS workflows that use the Planning capability and an event_stream_handler may not recover after the update. The project advises letting in-flight workflows finish before updating, or deploying a new DBOS application version.