Skip to content

fix(a2a)!: enforce the AdCP 3.3 operation-resolution hardening clauses - #1659

Merged
bokelley merged 2 commits into
nextfrom
claude/issue-1637-a2a-hardening
Oct 27, 2026
Merged

bokelley merged 2 commits into
nextfrom
claude/issue-1637-a2a-hardening

Conversation

@bokelley

@bokelley bokelley commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Refs #1637. This covers the enforcement part (batch A). Advertising request_signing.operation_sources waits on the 3.3 regenerated types and is not in this PR.

What changes

AdCP 3.3 makes the hardening clauses of security.mdx "Operation resolution over A2A" (tag v3.3.0-beta.0, GHSA-2pm6-6mc8-8xcm) MUST. SignedRequestVerificationMiddleware now resolves the operation of every A2A POST before it looks at any capability list or signature header:

  1. Strict parse, signed or unsigned. The body goes through signing/_strict_json.parse_strict_json (object_pairs_hook), which checks for duplicate keys after JSON string decoding, so "skill" and "skill" collide. A batch, a missing or non-string method, or a case variant of a recognized member (Skill, Parts, Method, ...) is rejected with 401 request_body_malformed at step 0.
  2. Part shape. Each Part has exactly one content member. FileParts (raw, url, file) are rejected. kind must agree with the content member. The message must have exactly one DataPart, its data must be an object, and skill must be a non-empty string.
  3. Gate to dispatcher hand-off (rule 3). The gate puts its resolved operation in the request scope. If the executor's parse comes out different, it refuses to dispatch with a task-level INVALID_REQUEST.
  4. Task-continuation binding. Executor tasks now record {"adcp_task_binding": {"operation": ..., "principal": "sha256:..."}} in Task.metadata. _OwnerCheckedRequestHandler refuses a message.taskId request before it creates the active task or enters the handler, unless both the operation and the principal match. A principal mismatch, or a task with no recorded principal (including any task an unauthenticated caller created), is answered as TaskNotFound, the same as a missing or foreign task, so the check cannot be used to probe for tasks. An operation mismatch on a task the caller owns is JSON-RPC InvalidParams with data.adcp_error.code = INVALID_REQUEST. In both cases the original task is not modified. This also works with a task store that does not partition by owner.

The resolver is adcp.server.a2a_server.resolve_a2a_operation. It also resolves the HTTP+JSON binding (POST …/message:send / :stream), so vector 022 passes, although the SDK only mounts JSON-RPC.

On MCP, a body with duplicate keys is now request_body_malformed. Otherwise MCP classification is unchanged: a batch or unparseable body is still opaque and treated as required when anything is required.

Conformance vectors

The spec's 33 A2A vectors (contradiction-resolution and hardening tiers) are vendored from v3.3.0-beta.0 into tests/conformance/vectors/a2a-operation-resolution/, with an UPSTREAM.json that pins each file's SHA-256. All of them pass through the middleware. The 3.2.4 copies under tests/conformance/vectors/request-signing/a2a/ differ only by verifier_capability.operation_sources. No test ran them before this PR.

Breaking

With verification enabled, an A2A request that does not resolve to exactly one operation is now refused with request_body_malformed. That includes text-only messages, TextPart JSON, several DataParts, a FilePart, a batch, and duplicate or case-variant keys. The refusal happens even when nothing is in required_for. Previously these requests got request_signature_required only when something was required, and passed through otherwise. Two existing tests asserted the old code, which contradicts security.mdx rule 1, so they were updated (tests/test_signed_request_verification.py).

Not covered here

  • The executor's default parser, used when no verifier is configured, still accepts the TextPart JSON fallback and extra non-invocation DataParts. The hardening clauses are scoped to verifiers.
  • The default parser reads parameters but not the A2A profile's input member. This is a separate issue.
  • server/auth.py's discovery-skill bypass still parses through parse_a2a_jsonrpc_skill without the strict resolver. It sits inside the gate when both are configured.

BREAKING CHANGE: With request signing configured, A2A requests that break the AdCP 3.3 operation-resolution hardening clauses (duplicate or case-variant keys, batches, malformed Parts, extra DataParts, mismatched task continuations) are refused with request_body_malformed or INVALID_REQUEST.

🤖 Generated with Claude Code

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Approve

Approve — AdCP 3.3 A2A operation-resolution hardening, correctly implemented and fail-closed.

No blocking findings. The reviewer confirmed resolve_a2a_operation (a2a_server.py:229–300) enforces exactly-one-DataPart with a non-empty string skill, rejects FileParts/case-variant members/kind-mismatches, and relies on parse_strict_json for duplicate-key detection — backed by 33 vendored conformance vectors plus unit, e2e, and MCP-duplicate-key tests. Gate→dispatcher hand-off (:841) and continuation-binding oracle ordering (principal mismatch → TaskNotFound at :453 before operation mismatch → INVALID_REQUEST at :458) are correct. The breaking behavior carries fix(a2a)! + a BREAKING CHANGE footer + migration note, satisfying the semver floor. The unauthenticated-caller continuation loss is intended, tested, and disclosed.

Decision-table trace: no critical/high/medium findings (rows 1,4,5,6,8 n/a); gated_paths false (row 2 n/a); high_risk true but reasons are only (modified) with zero medium findings, so rows 3 and 5 do not fire; no no-auto-approve team match (row 7 n/a). Falls through to row 9 → approve.

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Approve

Approve — AdCP 3.3 A2A operation-resolution hardening on the signature gate. Clean review, no Critical/High/Medium findings.

Checked:

  • Semver signal correct: fix(a2a)!: with BREAKING CHANGE footer + migration note for the tightening (unresolvable A2A bodies now return request_body_malformed/INVALID_REQUEST).
  • a2a_server.py (+341): fail-closed resolver — _resolve_message_skill requires exactly one DataPart + non-empty string skill; _reject_case_variants blocks case-folded member spoofing; FileParts/kind-mismatch rejected. Continuation binding answers principal-mismatch/unbound as TaskNotFound (no probe oracle), operation-mismatch as INVALID_REQUEST before task is touched. Rule-3 gate in execute refuses any op other than the gate-resolved one.
  • No creds in ctx_metadata; no _generated.py layering violations; no generated-code hand-edits; no CI gates disabled. Updated tests still assert fail-closed. Strict duplicate-key parse on both legs; 33 SHA-pinned conformance vectors.

high_risk is true via two (modified) entries in src/adcp/server/**, but with no medium-or-higher finding the modifications are presumed safe (row 5 does not fire). No gated paths, no team gate, no deletions. Falls through to row 9.

Non-blocking note: seller-delegated existing-VerifiedSigner path (signed_requests.py ~L620) re-checks over re-serialized parsed_body so the duplicate-key arm can't fire — acceptable, no parser-differential when reusing the seller's single parse.

@bokelley bokelley mentioned this pull request Oct 27, 2026
10 of 21 tasks
@bokelley bokelley closed this Oct 27, 2026
@bokelley bokelley reopened this Oct 27, 2026
bokelley and others added 2 commits October 27, 2026 03:55
The request-signature gate now resolves the AdCP operation of every A2A
POST per security.mdx "Operation resolution over A2A", hardening included:

- Strict parse before classification, signed or not: duplicate object
  keys are detected after JSON string decoding, and JSON-RPC batches, a
  missing or non-string method, and case-variant member names are
  rejected with request_body_malformed at the pre-check, before the
  capability lists and the signature-header checks.
- Part shape: one content member per Part, no FilePart (raw/url/file),
  kind agreement, exactly one DataPart whose data is an object with a
  non-empty string skill.
- The gate hands its resolved operation to the executor, which refuses
  to dispatch any other operation (task-level INVALID_REQUEST).
- Task-continuation binding: executor tasks record their operation and a
  digest of the creating principal in Task.metadata; a message.taskId
  request is refused before handler entry unless both match.

On MCP, a body with duplicate keys is now request_body_malformed.

The spec's 33 A2A conformance vectors (contradiction-resolution and
hardening tiers) are vendored from v3.3.0-beta.0 and pass.

BREAKING CHANGE: with request signature verification enabled, an A2A
request that does not resolve to exactly one operation (text-only or
TextPart-JSON message, several DataParts, a FilePart, a batch, duplicate
or case-variant keys) is now refused with 401 request_body_malformed,
even when no operation is in required_for. Previously such requests were
answered with request_signature_required only when something was
required, and passed through otherwise.

Refs #1637

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A principal mismatch, or a task with no recorded principal, now gets the
same TaskNotFound as a missing or foreign task, so the binding check is
no oracle for tasks the caller does not own. An operation mismatch on an
owned task stays INVALID_REQUEST.

Refs #1637

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@bokelley
bokelley force-pushed the claude/issue-1637-a2a-hardening branch from 32a0bb4 to 9e4b3eb Compare October 27, 2026 04:05

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Approve

Approve — clean security-hardening pass.

Checked:

  • No critical/high/medium findings from the reviewer.
  • gated_paths: false and review_decision: APPROVED — no hard gate blocks.
  • No no-auto-approve team match.
  • high_risk: true but both reasons are (modified) with zero medium-or-higher findings, so the modification is presumed safe (no deletions, no sensitive-category finding). Does not escalate on the flag alone.
  • Prior decision was approve; this run remains clean.

The delta is A2A operation-resolution security hardening in a2a_server.py and signed_requests.py, all fail-closed (rejects batches, missing/non-string methods, case-variant members, FileParts, zero/multi-DataPart messages; dispatch gate refuses non-gate-resolved skills; continuation binding refuses principal/operation mismatch and principal-less tasks), plus 33 conformance vectors and an 18-function test module. The two test-expectation flips (request_signature_required → request_body_malformed) are legitimate behavior updates, not disabled tests, so CI gates stay armed.

No decision-table row 1–8 fired → row 9 approve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant