CVE-2026-107291: Pydantic ai Exception Events On Tool And Vulnerability
LOWCVE-2026-107291 is a LOW exception events on tool and vulnerability (CWE-532: Insertion of Sensitive Information into Log File) affecting Pydantic ai libraries in the PyPI ecosystem. The issue involves exception events on tool and agent run spans include content when `include_content=false`. Remediation is available by upgrading affected packages to version 1.107.6, 2.44.0.
CVE-2026-107291 at a Glance
How to Fix CVE-2026-107291
To remediate this vulnerability, upgrade all affected Pydantic ai dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install pydantic-ai>=1.107.6
pip install pydantic-ai>=2.44.0
pip install pydantic-ai-slim>=1.107.6
pip install pydantic-ai-slim>=2.44.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show pydantic-ai
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2026-107291, inspect your installed packages using pip:
pip show pydantic-ai
Analyze the terminal output to locate any version of Pydantic ai in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.107.6), your application is affected.
Note: The pip show pydantic-ai command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-532: Insertion of Sensitive Information into Log File, where the product writes sensitive information to a log file. In Pydantic ai, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-107291 Affected Pydantic ai Versions
4 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
pydantic-ai
|
PyPI |
≥ 0.3.4
< 1.107.6
|
1.107.6
|
|
pydantic-ai
|
PyPI |
≥ 2.0.0b1
< 2.44.0
|
2.44.0
|
|
pydantic-ai-slim
|
PyPI |
≥ 0.3.4
< 1.107.6
|
1.107.6
|
|
pydantic-ai-slim
|
PyPI |
≥ 2.0.0b1
< 2.44.0
|
2.44.0
|
References
Frequently Asked Questions
What is CVE-2026-107291?
Which Pydantic ai versions are affected?
What version fixes CVE-2026-107291?
Is pydantic-ai affected?
Is pydantic-ai-slim affected?
What CWE is associated with CVE-2026-107291?
How can I check PyPI dependencies for CVE-2026-107291?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-4x9p-g9wm-8q7f",
"modified" : "2026-10-08T16:48:16Z",
"published" : "2026-10-08T16:48:16Z",
"aliases" : [ "CVE-2026-107291" ],
"summary" : "Pydantic AI OpenTelemetry instrumentation: exception events on tool and agent run spans include content when `include_content=False`",
"details" : "### Summary\n\nPydantic AI's OpenTelemetry instrumentation supports `InstrumentationSettings(include_content=False)` to exclude message content — user prompts, model completions, tool call arguments and responses, and any other message content — from exported telemetry, so that agents can be monitored without sending sensitive content to the observability backend.\n\nThe message attributes honoured the setting. Several other parts of the same spans did not, and exported content regardless of it:\n\n- **Exceptions.** Recorded as OpenTelemetry exception events, with their message and stack trace, on tool, agent run, model request, embedding and image generation spans, and on realtime session spans. The message of the exception carrying a tool's `ModelRetry` or `ToolFailed` feedback is the text sent back to the model, which can quote tool arguments and results. When a tool ran out of retries, the error that ended the run was chained from the last retry, so its stack trace repeated that text on the run span. Exceptions raised by tool code were recorded with their full message, as were failures of a model request, embedding or image generation, whose messages carry the provider's error response body.\n- **The error status description.** The OpenTelemetry SDK describes a span's ERROR status with the exception's type and message, so the message reached the backend a second time even where the event itself was redacted.\n- **Instructions and the prompted-output template.** The `model_request_parameters` attribute serialized the request's instruction parts in full, exporting the agent's instructions — both static and those built from dependencies at request time — along with the template used to prompt for structured output.\n\n### Details\n\nContent reaches these places because of what they carry rather than through any single missing check, which is why the setting was applied correctly to the message attributes (`gen_ai.input.messages`, `gen_ai.tool.call.arguments`, `gen_ai.tool.call.result`, and so on) while these paths were not: the exception recording and the status description came from the OpenTelemetry SDK's defaults, and the instructions and output template were serialized as part of the request's parameters rather than treated as content.\n\n### Impact\n\nThis does not grant an attacker any new access to the agent or its data: the content is only visible to whoever can read the exported telemetry. The exposure matters when traces are exported to a destination whose audience is broader or less trusted than the agent's own data — a third-party observability vendor or a shared backend — which is the scenario `include_content=False` exists for.\n\n### Who Is Affected\n\nYou are affected if you enabled instrumentation with `include_content=False`. Instructions are exported on every successful run, so no failure is needed to be affected; the exception paths additionally require a tool to raise, or a model, embedding or image generation request to fail. Realtime sessions are affected the same way, through the errors their provider connections report. GHSA-3gh4-cghq-f8v4 stated that retries coming from tool calls were redacted correctly; that was true of the retry prompt in the message attributes but not of the exception event on the tool span. You are not affected if you don't set `include_content=False`.\n\n### Remediation\n\nUpgrade to a patched version. With `include_content=False`, exception events now record only the exception type, error statuses carry no description, and `model_request_parameters` is exported without its instruction content or output template. If you rely on this setting, consider reviewing previously exported traces for exception events, for error status descriptions, and for `model_request_parameters`.\n\n### Workaround for Unpatched Versions\n\nIf you cannot upgrade, scrub the `exception.message` and `exception.stacktrace` event attributes, the error status description, and the instruction parts and `prompted_output_template` within `model_request_parameters`, on spans emitted by Pydantic AI in your telemetry pipeline (for example with an OpenTelemetry Collector processor). Setting `include_model_request_parameters=False` alongside `include_content=False` removes both, at the cost of the rest of that attribute.\n\n### Credits\n\nReported privately by @BrianWillows, whose report covered the exception events on tool and agent run spans. The remaining paths were found while fixing it, by a test that drives content through every channel at once and checks the whole exported trace.",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "pydantic-ai"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0.3.4"
}, {
"fixed" : "1.107.6"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "pydantic-ai"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.0.0b1"
}, {
"fixed" : "2.44.0"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "pydantic-ai-slim"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0.3.4"
}, {
"fixed" : "1.107.6"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "pydantic-ai-slim"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.0.0b1"
}, {
"fixed" : "2.44.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/pydantic/pydantic-ai/security/advisories/GHSA-4x9p-g9wm-8q7f"
}, {
"type" : "WEB",
"url" : "https://github.com/pydantic/pydantic-ai/pull/8403"
}, {
"type" : "WEB",
"url" : "https://github.com/pydantic/pydantic-ai/pull/8404"
}, {
"type" : "WEB",
"url" : "https://github.com/pydantic/pydantic-ai/pull/8408"
}, {
"type" : "WEB",
"url" : "https://github.com/pydantic/pydantic-ai/pull/8428"
}, {
"type" : "WEB",
"url" : "https://github.com/pydantic/pydantic-ai/pull/8429"
}, {
"type" : "WEB",
"url" : "https://github.com/pydantic/pydantic-ai/commit/4e013c51a50659aba2adf7853bfb22bb77f6a518"
}, {
"type" : "WEB",
"url" : "https://github.com/pydantic/pydantic-ai/commit/6b14c74cb281f899a2ae4fae5327111e33f60771"
}, {
"type" : "WEB",
"url" : "https://github.com/pydantic/pydantic-ai/commit/7ee27e38ab2e525ca60ff1a25d16413ff989fd79"
}, {
"type" : "WEB",
"url" : "https://github.com/pydantic/pydantic-ai/commit/963dec5f70d6f558997fc259356c0090cc5ea487"
}, {
"type" : "WEB",
"url" : "https://github.com/pydantic/pydantic-ai/commit/de4e61515327bd80a19cd8552001c30933e6acc3"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/pydantic/pydantic-ai"
}, {
"type" : "WEB",
"url" : "https://github.com/pydantic/pydantic-ai/releases/tag/v1.107.6"
}, {
"type" : "WEB",
"url" : "https://github.com/pydantic/pydantic-ai/releases/tag/v2.44.0"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-212", "CWE-532" ],
"severity" : "LOW",
"github_reviewed" : true,
"github_reviewed_at" : "2026-10-08T16:48:16Z",
"nvd_published_at" : null
}
}