CVE-2026-107291
OpenTelemetry can leak sensitive agent content despite include_content=False setting.
- CVSS 2.3
- CWE-212
- Information Leakage
- Remote
Pydantic AI is a Python agent framework for building applications and workflows with Generative AI. From 0.3.4 until 1.107.6 and 2.44.0, OpenTelemetry instrumentation configured with InstrumentationSettings(include_content=False) can still export sensitive agent content through exception.message and exception.stacktrace events, error status descriptions, and model_request_parameters containing instructions or the prompted_output_template. The exposed data is available to readers of the configured telemetry backend and can include tool feedback, provider error bodies, runtime instructions, and structured-output templates even though message attributes are redacted. This issue does not grant new access to agent data, and deployments that do not use include_content=False are not affected by the setting bypass. This issue is fixed in versions 1.107.6 and 2.44.0.
- CWE
- CWE-212
- CVSS base score
- 2.3
- Published
- 2026-10-08
- OWASP
- A09 Security Logging and Monitoring Failures
- Orthogonal defect classification
- Interface
- Code defect classification
- Incorrect Interface
- Category
- Information Leakage
- Subcategory
- Information Disclosure
- Accessibility scope
- Remote
- Impact
- Information Disclosure
- Affected component
- Pydantic AI
- Fixed by upgrading
- Yes
Solution
Upgrade to Pydantic AI v1.107.6 or later (or v2.44.0 or later).
Vulnerable code sample
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import SimpleSpanProcessor, ConsoleSpanExporter
from pydantic_ai.instrumentation import InstrumentationSettings, PydanticAIOtelInstrumentation
# Setup tracing
trace.set_tracer_provider(TracerProvider())
trace.get_tracer_provider().add_span_processor(
SimpleSpanProcessor(ConsoleSpanExporter())
)
# VULNERABLE: exception details are added despite include_content=False
instrumentation = PydanticAIOtelInstrumentation(
settings=InstrumentationSettings(include_content=False)
)
instrumentation.instrument()
def run_agent():
tracer = trace.get_tracer(__name__)
with tracer.start_as_current_span("agent.run") as span:
try:
# Simulate agent error that includes sensitive instruction
raise ValueError("Secret instruction: DELETE_ALL_DATA")
except Exception as e:
# Leak sensitive message and stacktrace
span.set_attribute("exception.message", str(e))
span.set_attribute("exception.stacktrace", "".join(trace.format_exception(type(e), e, e.__traceback__)))
raise
run_agent()Patched code sample
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import SimpleSpanProcessor, ConsoleSpanExporter
from pydantic_ai.instrumentation import InstrumentationSettings, PydanticAIOtelInstrumentation
# Setup tracing
trace.set_tracer_provider(TracerProvider())
trace.get_tracer_provider().add_span_processor(
SimpleSpanProcessor(ConsoleSpanExporter())
)
# FIX: avoid adding exception details when include_content=False
instrumentation = PydanticAIOtelInstrumentation(
settings=InstrumentationSettings(include_content=False)
)
instrumentation.instrument()
def run_agent():
tracer = trace.get_tracer(__name__)
with tracer.start_as_current_span("agent.run") as span:
try:
# Simulate agent error that includes sensitive instruction
raise ValueError("Secret instruction: DELETE_ALL_DATA")
except Exception as e:
# Do not expose exception.message or stacktrace
span.record_exception(e) # OpenTelemetry will respect include_content setting
raise
run_agent()Published fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- Follow the same exception recording rule on the model request and realtime spans (#8408) (pydantic/pydantic-ai)
pydantic_ai_slim/pydantic_ai/capabilities/instrumentation.py,pydantic_ai_slim/pydantic_ai/capabilities/instrumentation.py · Instrumentation.wrap_run,pydantic_ai_slim/pydantic_ai/realtime/_instrumentation.py,pydantic_ai_slim/pydantic_ai/realtime/_instrumentation.py · SessionInstrumentation.record_error,pydantic_ai_slim/pydantic_ai/realtime/_session.py · RealtimeSession.close,pydantic_ai_slim/pydantic_ai/_instrumentation.py,pydantic_ai_slim/pydantic_ai/_instrumentation.py · open_model_request_span - Share exception recording between agent run and tool spans in `Instrumentation` (#8403) (pydantic/pydantic-ai)
pydantic_ai_slim/pydantic_ai/capabilities/instrumentation.py,pydantic_ai_slim/pydantic_ai/capabilities/instrumentation.py · Instrumentation.on_tool_validate_error,pydantic_ai_slim/pydantic_ai/capabilities/instrumentation.py · Instrumentation.wrap_run,pydantic_ai_slim/pydantic_ai/capabilities/instrumentation.py · Instrumentation._run_tool_span - Close two `include_content` redaction bypasses and make the content sweep prove itself (v1 backport) (#8429) (pydantic/pydantic-ai)
pydantic_ai_slim/pydantic_ai/capabilities/instrumentation.py,pydantic_ai_slim/pydantic_ai/capabilities/instrumentation.py · Instrumentation.wrap_run,pydantic_ai_slim/pydantic_ai/models/fallback.py,pydantic_ai_slim/pydantic_ai/models/fallback.py · FallbackModel._set_span_attributes,pydantic_ai_slim/pydantic_ai/_instrumentation.py,pydantic_ai_slim/pydantic_ai/_instrumentation.py · model_request_parameters_attributes,pydantic_ai_slim/pydantic_ai/_instrumentation.py · open_model_request_span,pydantic_ai_slim/pydantic_ai/_instrumentation.py · record_exception,pydantic_ai_slim/pydantic_ai/_instrumentation.py · set_error_status - Share exception recording between the agent run, tool and model request spans in `Instrumentation` (v1 backport) (#8404) (pydantic/pydantic-ai)
pydantic_ai_slim/pydantic_ai/capabilities/instrumentation.py,pydantic_ai_slim/pydantic_ai/capabilities/instrumentation.py · Instrumentation.wrap_run,pydantic_ai_slim/pydantic_ai/capabilities/instrumentation.py · Instrumentation._run_tool_span,pydantic_ai_slim/pydantic_ai/_instrumentation.py,pydantic_ai_slim/pydantic_ai/_instrumentation.py · open_model_request_span - Close two `include_content` redaction bypasses and make the content sweep prove itself (#8428) (pydantic/pydantic-ai)
pydantic_ai_slim/pydantic_ai/models/fallback.py,pydantic_ai_slim/pydantic_ai/models/fallback.py · FallbackModel._set_span_attributes,pydantic_ai_slim/pydantic_ai/_instrumentation.py,pydantic_ai_slim/pydantic_ai/_instrumentation.py · capture_current_context,pydantic_ai_slim/pydantic_ai/_instrumentation.py · model_request_parameters_attributes,pydantic_ai_slim/pydantic_ai/_instrumentation.py · open_model_request_span,pydantic_ai_slim/pydantic_ai/_instrumentation.py · _serialize_model_request_parameters
Cite this entry
@misc{vaitp:cve2026107291,
title = {{OpenTelemetry can leak sensitive agent content despite include_content=False setting.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-107291},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-107291/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
