Repository navigation
fix(a2a)!: enforce the AdCP 3.3 operation-resolution hardening clauses - #1659
Conversation
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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_skillrequires exactly one DataPart + non-empty string skill;_reject_case_variantsblocks 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.pylayering 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.
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]>
32a0bb4 to
9e4b3eb
Compare
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean security-hardening pass.
Checked:
- No critical/high/medium findings from the reviewer.
gated_paths: falseandreview_decision: APPROVED— no hard gate blocks.- No no-auto-approve team match.
high_risk: truebut 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.
Refs #1637. This covers the enforcement part (batch A). Advertising
request_signing.operation_sourceswaits 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.SignedRequestVerificationMiddlewarenow resolves the operation of every A2A POST before it looks at any capability list or signature header: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-stringmethod, or a case variant of a recognized member (Skill,Parts,Method, ...) is rejected with401 request_body_malformedat step 0.raw,url,file) are rejected.kindmust agree with the content member. The message must have exactly one DataPart, itsdatamust be an object, andskillmust be a non-empty string.INVALID_REQUEST.{"adcp_task_binding": {"operation": ..., "principal": "sha256:..."}}inTask.metadata._OwnerCheckedRequestHandlerrefuses amessage.taskIdrequest 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 withdata.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.0intotests/conformance/vectors/a2a-operation-resolution/, with anUPSTREAM.jsonthat pins each file's SHA-256. All of them pass through the middleware. The 3.2.4 copies undertests/conformance/vectors/request-signing/a2a/differ only byverifier_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 inrequired_for. Previously these requests gotrequest_signature_requiredonly 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
parametersbut not the A2A profile'sinputmember. This is a separate issue.server/auth.py's discovery-skill bypass still parses throughparse_a2a_jsonrpc_skillwithout 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