Skip to content

fix(security): upgrade pydantic-ai past 2.35.0, whose three advisories fail the devops ci audit #1446

Closed

Description

@dan-petty

Problem

pyproject.toml pins pydantic-ai==2.35.0, and uv.lock locks pydantic-ai, pydantic-ai-slim and pydantic-evals at 2.35.0. Three advisories published against that version make uv audit, and with it uv run devops ci and the pre-push gate, fail on every branch, including release/v0.2.29 at 55c235e:

  • GHSA-4x9p-g9wm-8q7f: OpenTelemetry instrumentation includes content in exception events on tool and agent run spans when include_content=False.
  • GHSA-fpf4-vwcp-v4hp: quadratic title extraction in web_fetch blocks the event loop.
  • GHSA-vmxc-h2x2-jmf3: the SSRF cloud-metadata blocklist can be bypassed with IPv6 zone identifiers.

All three are fixed in 2.44.0 (and 1.107.6). The latest release is 2.54.0 (2026-10-03).

Proposed remedy

Pin pydantic-ai==2.54.0, the latest 2.x, and relock the pydantic-ai packages with uv lock --upgrade-package. #1001 moves the model layer onto pydantic-ai, so the current release is the one to build on. Fix any API changes the upgrade surfaces, without adding shims.

Acceptance criteria

  • uv audit reports no pydantic-ai advisory, and uv run devops ci passes.
  • pyproject.toml and uv.lock agree, and only the pydantic-ai family and the packages they require change in the lock.
  • changelog.d/<n>.md records the upgrade under ### Security.

Related: #1001, #1120.

Opened as a borrow (#1153, budget/borrowed): a security fix that blocks the release gate.

Update 2026-10-08: delivered scope

  • pydantic-ai==2.54.0. The lock moves pydantic-ai, pydantic-ai-slim, pydantic-evals and pydantic-graph to 2.54.0, and the resolver requires anthropic 1.12.1, openai 3.26.1 and google-genai 2.29.0. Nothing else in the lock changes. uv audit reports no advisory and uv run devops ci passes.
  • 2.44.0, the first fixed release, already removed pydantic_ai._cost and broke the same private imports, so no fixed version avoided the migration; the latest was taken.
  • The private pydantic-ai imports that 2.54.0 broke now use public APIs: genai-prices pricing, the pydantic_ai.durable_exec engine builder for LocalDurabilityCapability, pydantic_ai.run for the enqueue types, and OpenTelemetry's propagator for the traceparent. Unused re-exports of pydantic-ai internals and the _is_call_ctx monkey-patch are removed. The DeferredToolRequests.build_results override accepts Mapping approvals.
  • Left for refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001: pydantic_ai._ssrf in core/validation.py and http/egress.py, because pydantic-ai has no public SSRF classifier, and resolve_model_id_sync reading the durable base's _models_by_id. Both are listed in the task file and noted on refactor(ai): one model seam: llmclient over three wire adapters behind one factory, no second provider stack #1001.
  • Behaviour changes that come with the library: the local durability engine's event handler must be async, an agent holds at most one durability capability, and tool contexts must be annotated with pydantic-ai's RunContext.

Activity

  1. added
    type/security
    scope/ai
    scope/security
    source/agent
    on Oct 8, 2026
  2. dan-petty-bot commented on Oct 8, 2026

    @dan-petty-bot
    Collaborator

    Intake placed this item to the backlog: at intake only a critical fix goes into a release; a release start pulls Ready items in, P0 features first.

    • Priority: P1-High. Three security advisories block the CI and pre-push gate on every branch, including the active release branch, making this a release-blocking security fix. The advisory GHSA-4x9p-g9wm-8q7f does not set P0: the author has no write access, and no caller attached it as evidence. A person can set P0 on the board.
    • Value: High. Unblocks the entire CI/release pipeline and eliminates three known vulnerabilities (data leakage, DoS, SSRF bypass) in a shipped dependency.
    • Effort: Medium. Upgrading from 2.35.0 to 2.54.0 spans many minor versions and may surface API changes that need fixing, but the target version and scope are well-defined.
  3. added this to the v0.2.29 milestone on Oct 8, 2026
  4. dan-petty commented on Oct 8, 2026

    @dan-petty
    OwnerAuthor

    Placed in v0.2.29 under the owner's 2026-10-08 instruction to pull every issue that blocks the roadmap Service into the current release: since these advisories were published, uv audit fails devops ci, the pre-push gate and CI's Static Analysis on every branch, so no remaining v0.2.29 fix (#1400, #1360) can be pushed or merged until this lands. Please keep it in v0.2.29.

  5. dan-petty-bot commented on Oct 8, 2026

    @dan-petty-bot
    Collaborator

    What changed

    #1447, merged into release/v0.2.29 as 327964d.

    Closes #1446

    pydantic-ai 2.35.0 has three advisories (GHSA-4x9p-g9wm-8q7f, GHSA-fpf4-vwcp-v4hp, GHSA-vmxc-h2x2-jmf3), so uv audit failed devops ci, the pre-push gate and CI's Static Analysis on every branch. This pins pydantic-ai==2.54.0 and relocks the pydantic-ai family. The resolver also moves anthropic (1.12.1), openai (3.26.1) and google-genai (2.29.0); nothing else in the lock changes.

    2.54.0 removed or changed private modules devops-cli imported. Each one now uses a public API or is gone:

    • _cost.best_effort_price (removed upstream): calculate_usage_cost prices with genai_prices.calc_price, which ai/spend/pricing.py already uses.
    • _output and _sync_stream: these re-exports were unused and are removed.
    • The _function_schema._is_call_ctx monkey-patch, which silently stopped working when upstream renamed the function: removed. load_capability annotates its context with pydantic-ai's RunContext and narrows to the devops subclass, as harness/workflow.py's delegate_task already did.
    • durable_exec._base and _runtime_toolsets: LocalDurabilityCapability is built on the public pydantic_ai.durable_exec engine API: a DurabilityEngineSpec and an in-process operation backend subclassing JournalCallableOperationBackend. The overrides of private base methods are gone.
    • _enqueue: the names come from pydantic_ai.run, with a mypy implicit_reexport override for that module only.
    • _instrumentation.current_otel_traceparent: replaced by…

    21 file(s) changed.

    How it was verified

    Check runs at 4db2da6:

    • Prune PR DevContainer Images: pass
    • CodeQL: pass
    • Analyze (actions): pass
    • Analyze (python): pass
    • Static Analysis: pass
    • Tests & Coverage: pass
    • DevContainer Image: skipping
    • Service Image: skipping
    • Dependency Freshness: skipping

    Acceptance Criteria of docs/agent/tasks/task-1446-pydantic-ai-advisories.md:

    • uv audit reports no pydantic-ai advisory, and uv run devops ci passes.
    • pyproject.toml and uv.lock agree. The lock changes only the four pydantic-ai packages and the anthropic, openai and google-genai versions the resolver requires.
    • changelog.d/1446.md records the upgrade under ### Security, with the API changes under ### Changed and ### Removed. CHANGELOG.md and docs/ROADMAP.md are untouched.
    • The only private pydantic-ai imports left in src are the two pydantic_ai._ssrf imports listed above. There are no version checks, ImportError fallbacks or copied internals.
    • Tests change only where the API changed:
      • tests/test_pydantic_ai_durable.py imports BaseDurabilityCapability from pydantic_ai.durable_exec.
      • test_local_durability_delivers_run_events_and_leaves_toolsets_unwrapped replaces the test that called the private _dispatch_event_stream_event and _wrap_leaf_toolset. It runs an agent on TestModel and checks that the async handler receives the tool call and result events, that get_wrapper_toolset leaves every toolset unwrapped, and that the steps are recorded.
      • The extended-options test uses StepPersistence as its extra capability, since a second engine is refused.
      • Three test tools annotate their context with pydantic-ai's RunContext.
      • The result and run tests drop the removed names, and test_get_active_traceparent pins the traceparent of a known span context and None outside a span.
      • No test reaches the network, and each one finishes in under 1 s.
    • The knowledge base pages that named 2.35.0 (libraries/pydantic_ai.md, python_packages.md) name 2.54.0, and uv run devops docs generate --sync-readme leaves the generated docs unchanged.
  6. added a commit that references this issue on Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope/aiscope/securitysource/agenttype/security

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions