Skip to content

Tier 2 commercial-identity error codes don't conform to AdCP spec — cross-tenant oracle risk #375

Closed

Description

@bokelley

Summary

The Python SDK raises four non-spec error codes in src/adcp/decisioning/handler.py and src/adcp/decisioning/registry.py for the v3 buyer-agent gate. The codes the spec rejects are emitted today as load-bearing public wire errors:

  • AGENT_SUSPENDED
  • AGENT_BLOCKED
  • REQUEST_AUTH_UNRECOGNIZED_AGENT
  • INVALID_BILLING_MODEL

Why it's wrong

The AdCP spec at static/schemas/source/error-details/agent-permission-denied.json (line 10) explicitly considers and rejects separate codes for these scenarios on cross-tenant onboarding-oracle grounds:

If a future major version elevates suspended / blocked to dedicated error codes (e.g., AGENT_SUSPENDED / AGENT_BLOCKED), those codes will carry their own details shapes and SHOULD NOT carry an explicit scope field — the code itself is the discriminator on that path.

And, more importantly, the schema description and error-handling.mdx (Per-Agent Authorization Gate) require identical observable channels — code, message, headers, latency, side effects — between the unrecognized-agent path and the recognized-but-denied path. Distinct codes per status leak which agent_urls are onboarded with which sellers, enabling cross-tenant enumeration of commercial relationships.

Required fixes

Code surface

  • AGENT_SUSPENDED → PERMISSION_DENIED with details.scope=\"agent\", details.status=\"suspended\". Recovery is currently transient; the spec treats suspension as terminal-pending-onboarding (the agent MUST surface to a human; auto-retry is not a recovery path).
  • AGENT_BLOCKED → PERMISSION_DENIED with details.scope=\"agent\", details.status=\"blocked\", recovery terminal.
  • REQUEST_AUTH_UNRECOGNIZED_AGENT → PERMISSION_DENIED with scope omitted (must be indistinguishable on the wire from recognized-but-denied; the schema's omit-on-unestablished-identity rule).
  • INVALID_BILLING_MODEL → BILLING_NOT_PERMITTED_FOR_AGENT with details.rejected_billing (required) and optional details.suggested_billing per error-details/billing-not-permitted-for-agent.json. The current details payload also leaks permitted_billing (the full subset), which the billing schema explicitly forbids — "MUST NOT carry the agent's full permitted-billing subset".

Non-trivial requirement: parity, not just renaming

The spec's clamp is normative on latency / headers / side-effects / observability parity between:

  • the unrecognized-agent path (registry returned None)
  • the recognized-but-denied path (status suspended/blocked/unknown, or billing not permitted)

The current eager-raise pattern in _resolve_buyer_agent likely violates this:

  • The unrecognized-agent branch raises immediately after the registry returns None.
  • The suspended/blocked branches raise after a successful registry hit — measurable as a different latency profile.
  • Logging may differ (status-known branches log structured details; the unknown branch may not).

A correct implementation needs to fold all four denial paths through a common emit point with deliberate latency padding, identical headers, and side-effect parity (audit-log shape, metrics tags). Worth a design pass — naive renaming will close the code mismatch but leave the oracle.

Refs

  • Spec: static/schemas/source/error-details/agent-permission-denied.json line 10 (the elevation note); static/schemas/source/error-details/billing-not-permitted-for-agent.json (the billing details shape).
  • SDK: src/adcp/decisioning/handler.py lines 377, 394, 407, 421; src/adcp/decisioning/registry.py line 350.

Notes

Activity

  1. added
    bug
    claude-triaging
    on May 3, 2026
  2. bokelley commented on May 3, 2026

    @bokelley
    ContributorAuthor

    Triage

    Classification: Bug (spec-conformance + security)
    Bucket(s): handlers — no matching bucket label exists in this repo (label gap: security and spec-conformance absent)
    Status: ready-for-human

    What the experts said:

    • security-reviewer: Intra-seller status enumeration oracle is Medium (not cross-tenant as described — registry is per-seller, so a credential for seller A cannot probe seller B's registry; the attacker must hold HttpSig signing capability per target agent_url). Timing oracle is Low — both denial paths share the same DB round-trip; the difference is a Python branch comparison, immeasurable over HTTPS. permitted_billing leak is Medium as a spec-compliance issue but the information is self-data only (the caller reads their own capabilities). Stripping permitted_billing from details is a one-line fix.
    • ad-tech-protocol-expert: All four codes are confirmed non-spec SDK inventions — absent from the 51-entry error-code.json enum and not vendor-extension-prefixed (X_ prefix required per vendor-error-codes schema). The issue's proposed replacement BILLING_NOT_PERMITTED_FOR_AGENT is also absent from the spec; PERMISSION_DENIED is the correct replacement for all four cases. However, PERMISSION_DENIED is normatively hardwired to recovery=correctable in the enumMetadata block (SDKs MUST consume this, per its $comment), making the issue's proposed recovery=terminal for suspension/blocking non-conformant without a spec change — ACCOUNT_SUSPENDED (already terminal) is the structural template for entity-level suspension. The proposed details.scope field has no schema backing. Replacing these codes is a semver major breaking change.

    My take: The core diagnosis is correct — four SDK-invented codes violate the spec vocabulary and the intra-seller enumeration oracle is real — but the proposed fix has two unresolved spec conflicts: BILLING_NOT_PERMITTED_FOR_AGENT doesn't exist in the AdCP error vocabulary, and PERMISSION_DENIED is normatively locked to recovery=correctable, making the issue's proposed terminal recovery for suspension/blocking non-conformant without a spec change. Needs a versioning decision (semver major) and protocol resolutions on the billing code and recovery semantics before implementation can proceed.

    cc @bokelley for protocol resolution and versioning sign-off.


    Triaged by Claude Code. Session: https://claude.ai/code/${CLAUDE_CODE_REMOTE_SESSION_ID}


    Generated by Claude Code

  3. added
    v3.1
    and removed
    claude-triaging
    on May 3, 2026
  4. bokelley commented on May 3, 2026

    @bokelley
    ContributorAuthor

    Expert review of Path A (PR #399) — findings to roll into Path C / v3.1

    PR #399 ships the one-line permitted_billing leak fix. Three reviews agree it ships, with two cosmetic improvements to fold into the v3.1 rename PR (Path C):

    Spec language is stronger than the issue describes (ad-tech-protocol-expert)

    The upstream static/schemas/source/error-details/billing-not-permitted-for-agent.json description says verbatim:

    "It MUST NOT carry the agent's full permitted-billing subset… any field carrying per-agent commercial state is forbidden, even if additionalProperties would permit it."

    Combined with additionalProperties: false and a closed two-field shape (rejected_billing required, suggested_billing optional). The forbidden class is broader than just the permitted set — it covers any per-agent commercial-state field.

    v3.1-PR follow-ups (deferred from PR #399)

    • Rename details.requested_billing → details.rejected_billing — matches the spec's canonical key. Keep paired with the code rename to avoid double-breaking adopters.
    • Drop details.agent_url — recognized caller already knows its own URL; agent_url is per-agent identity scaffolding the spec's recommended-shape doesn't include. Borderline whether it qualifies as "per-agent commercial state" but at minimum non-recommended-shape.
    • Sync the missing schema file — schemas/cache/error-details/billing-not-permitted-for-agent.json is absent from this SDK's bundled cache. The v3.1 schema sync should pull it in alongside the code change.

    Confirmed safe to leave on INVALID_BILLING_MODEL for Path A

    • code / field="billing" / recovery="terminal" are not meaningful cross-agent oracles (security-reviewer: "discloses one bit about the caller's own row, which the recognized caller already knows"). The deferred rename is cosmetic, not a security gate.
    • No sibling leak paths in handler.py/registry.py/wire projection — validate_billing_for_agent is the sole emit site.

    Path A status

    PR #399 — all 12 CI checks green. Ready to merge.

  5. bokelley commented on May 3, 2026

    @bokelley
    ContributorAuthor

    Triage update

    v3.1 deferred items noted — queued for the next v3.1 sweep via the label:

    1. Rename details.requested_billing → details.rejected_billing (spec canonical key; paired rename to avoid double-breaking adopters)
    2. Drop details.agent_url (non-recommended-shape; recognized caller already knows its own URL)
    3. Pull schemas/cache/error-details/billing-not-permitted-for-agent.json into the SDK bundled cache

    One flag on PR #399: current API state shows mergeable_state: dirty (conflicts against main), so it will need a rebase before it can land even though all 12 CI checks are green.


    Triaged by Claude Code. Session: https://claude.ai/code/${CLAUDE_CODE_REMOTE_SESSION_ID}


    Generated by Claude Code

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

    bugclaude-triagedv3.1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions