Repository navigation
fix(storyboard): grade content-digest vectors against the selected verifier profile - #2963
Conversation
There was a problem hiding this comment.
Ladon verdict: Approve
Approve.
Wires the agent's declared request_signing capability into the storyboard request-signing dispatch (resolveAgentCapability) so the grader's capabilityMismatch preflight runs — fixing false failures on the negative/007/018 policy pair — and narrows the 'either'-agent content-digest skip to the two policy-refusal outcomes so 002/010/023 grade instead of over-skipping.
Checked: narrowing logic, cross-path consistency, fail-closed resolveAgentCapability parsing, the changeset (patch, correct for this behavior-only fix), and the four self-validating tests. No fabrication/re-shaping concerns (witness-not-translator preserved), no new transport reimplementation. No blocking or Medium findings.
No escalation triggers: high_risk false, gated_paths false, no author team gate, no prior decision. Rows 1–8 do not fire → row 9 approve.
…nswer `capabilityMismatch` and `contentDigestPolicyMismatch` both decided the declared-policy skip from the vector's `verifier_capability.covers_content_digest` alone. The shipped fixtures set that field to `'required'` on vectors whose assertion has nothing to do with the policy, so against an agent declaring `'either'` the predicate excluded every vector that so much as mentions content-digest: `positive/002` (a covered digest that must be ACCEPTED), `negative/010` (a falsified digest, `request_signature_digest_mismatch`) and `negative/023` (a malformed digest header, `request_signature_header_malformed`). That is wider than the rule the function's own doc comment describes, which names vectors 007 and 018 and no others. Per security.mdx, `'either'` means "signer chooses; verifier accepts both" — the widest policy, not a third incompatible one — so the only ungradable vectors are the two whose expected outcome IS the narrowing: `request_signature_components_incomplete` and `request_signature_components_unexpected`. Both predicates now share one `contentDigestDeclarationMismatch` helper that keys the `'either'` case on the vector's expected outcome. Strict-vs-strict mismatches are unchanged.
8da8a6e to
67dd788
Compare
|
Takeover update: I rebased this PR onto current main and narrowed it to the first, independently valid commit. The live-advertisement wiring was removed because exact-head review demonstrated that a permissive/under-declared capability block could suppress 39 of 40 signing vectors. The remaining change only fixes |
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean grading-fidelity fix, no blocking or medium findings.
What I checked:
- Request-signing grader refactor (
grader.ts):contentDigestDeclarationMismatchadded andkindthreaded throughcapabilityMismatch/contentDigestPolicyMismatch. The'either'-agent skip is correctly narrowed to the two policy-refusal outcomes (002/010/023 now grade; 007/018 still skip). Strict-vs-strict behavior preserved and theNegativeVectorcast is guarded bykind. - Changeset: correct
patchfor a grading-fidelity change undersrc/lib/testing/— impact type is not understated (no removed/renamed exports, param flips, or response-shape changes). - Test coverage added in
test/lib/request-signing-content-digest-policy.test.js.
No critical/high/medium findings. No witness-not-translator or transport-client concerns. Prior decision was also approve; the sole delta commit is a clean pass. high_risk=false, gated_paths=false, no author-team gate. Falls through to row 9.
…lls gaps Measured on the box after the case-insensitive merge landed: A2A went 42p/48f -> 66p/24f, and of the six remaining failures exactly one was A2A-specific — `negative-022-multi-valued-content-type`, answering `request_signature_window_invalid` where the vector expects `request_signature_header_malformed`. The precedence was backwards. 022 presents a deliberately MULTI-VALUED `Content-Type`, and that header is the fault under test; letting the official client's clean `content-type` override it destroys the vector, so the agent answers about a different defect and the run grades a request nobody meant to send. The client's headers now fill only what the fixture does not set — `a2a-version`, `accept` — which is also what the implementation that scored 59 on this agent did: it took the vector's headers and added the version header, nothing more. The other five failures are not this transport: `negative-007` and `negative-018` fail identically on MCP and A2A (the `agentCapability` fix in adcontextprotocol#2963, absent from this build), and the sixth is a version-pin assertion in the harness used to run the experiment.
Brings in adcontextprotocol#2963 (content-digest vectors graded against the selected verifier profile) and adcontextprotocol#2968 (native-mode A2A compliance), both of which touch the grading path this branch changes. Clean merge; the conformance measurement is taken against this state rather than a branch five commits behind main.
* fix(storyboard): sign the request the official A2A client emits An A2A run reports every request-signing vector as `signing_transport_unavailable`. #2958 made that fail-closed, which was right — the previous behaviour POSTed an MCP `initialize` at an A2A endpoint and graded the 405 as a signature failure. But it leaves no A2A agent's verifier graded at all, and the gap is permanent unless the dispatch is wired. This wires it, in the shape #2958's own comment described as the correct one: "signing a request the official client issues — applying each vector's RFC 9421 headers to that client's own request". WHAT DECIDES THE WIRE. `@a2a-js/sdk`'s `ClientFactory` resolves the agent card and builds the call; the request is captured at the SDK's own `fetchImpl` seam and those exact bytes are signed. Nothing about the A2A wire is written down here: endpoint <- the card's supportedInterfaces[] JSON-RPC method name <- the SDK, per the card's protocolVersion a2a-version header <- the SDK, from that same version proto-JSON encoding <- the SDK (role -> "ROLE_USER", not 1) payload key <- the SDK (input on 1.x, parameters on 0.x) Observed, not assumed, and asserted in tests: against a card declaring 1.0 the client emits {"method":"SendMessage"} with `a2a-version: 1.0`; against 0.3.0 the same `cancelTask` call emits {"method":"tasks/cancel"} with `a2a-version: 0.3`. That second one matters — it is the method the AdCP spec's `protocol_methods_*` namespace names (security.mdx @ 3.1.1 :1045 cites "A2A 0.3.0 §7.x"), so vector 028 is graded by the official client issuing the lifecycle call natively rather than by anyone framing an envelope. ORDERING. Capture happens before signing, so `a2a-version` is inside the signature base. A header added after signing sits outside the base the verifier reconstructs. FAIL-CLOSED IS PRESERVED, NOT REPLACED. `resolveVectorTransport` still returns no framing for A2A — it cannot answer the question, which is whether the card resolves, and that is a fetch. The decision moved into the async dispatcher: when the card resolves to a JSONRPC interface the vectors dispatch; when it does not, nothing is framed on a guess and the vector keeps #2958's `signing_transport_unavailable` reporting and every guardrail around it. All 44 tests in request-signing-vector-transport.test.js pass unchanged. `@a2a-js/sdk` stays a peer dependency: the import is dynamic and inside the A2A path, so grading an MCP agent never loads it. Tests: 7 new, each asserting that a protocol decision was the SDK's. The availability gate is graded both ways — a resolvable card makes dispatch available and names the endpoint it resolved; an unreachable one stays unavailable rather than inventing an endpoint. Supersedes #2964, which hand-built the envelope. That objection was fair and this does not repeat it. * fix(storyboard): merge A2A headers case-insensitively, so none is sent twice Measured against a live agent on the box: 42 of 90 A2A vectors passed and 16 of the 27 failures were the agent answering `request_signature_header_malformed` — refusing at checklist step 1, before it evaluated anything the vector grades. The cause was here, not in the agent. `applyTransport` merged the fixture's recorded headers with the client's using a plain object spread, and object keys are CASE-SENSITIVE while HTTP header names are not. A fixture carrying `Content-Type` and a client emitting `content-type` therefore both survived the merge, and the request went out carrying the header twice. That the agent under test is transport-independent is what localizes it: its verifier takes no protocol argument and runs the same code on every transport, so a refusal that appears on A2A and not on MCP has to come from the request, not from verification. Regression test asserts the header appears exactly once, and is non-vacuous — with the merge reverted it fails with `got ["Content-Type","content-type"]`. * fix(storyboard): let the FIXTURE's headers win; the transport only fills gaps Measured on the box after the case-insensitive merge landed: A2A went 42p/48f -> 66p/24f, and of the six remaining failures exactly one was A2A-specific — `negative-022-multi-valued-content-type`, answering `request_signature_window_invalid` where the vector expects `request_signature_header_malformed`. The precedence was backwards. 022 presents a deliberately MULTI-VALUED `Content-Type`, and that header is the fault under test; letting the official client's clean `content-type` override it destroys the vector, so the agent answers about a different defect and the run grades a request nobody meant to send. The client's headers now fill only what the fixture does not set — `a2a-version`, `accept` — which is also what the implementation that scored 59 on this agent did: it took the vector's headers and added the version header, nothing more. The other five failures are not this transport: `negative-007` and `negative-018` fail identically on MCP and A2A (the `agentCapability` fix in #2963, absent from this build), and the sixth is a version-pin assertion in the harness used to run the experiment. * fix(storyboard): skip URL-edge vectors on EVERY single-endpoint transport Measured on the box: mcp graded 82 vectors and a2a graded 90, so the two cards were no longer measuring the same thing and a2a's higher pass count (66 vs 59) was inflation rather than coverage. The canonicalization-edge positives (005-008) bake their edge into the vector URL's port, path or query. Any transport that routes every vector to one endpoint neutralizes that edge, so passing says nothing about it. The skip existed but was gated on `transport === 'mcp'`, and A2A routes every vector to the one RPC endpoint its card names for exactly the same reason — so on A2A those vectors were graded, and reported as PASSES. Coverage claimed, not delivered. The gate now reads "not raw", which is what the condition always meant: `raw` is the only transport that preserves the vector's own URL, and it is where this edge is gradable. adcp-client#2964 stated this property in its description; reimplementing lost it. * test(storyboard): make the merge-order guard actually guard the merge order Ladon's medium finding on c49689d was right: the test located vector 022 and then built `loaded.positive[0]`, asserting only `a2a-version`/`accept`. Both of those are gap-fills present under either merge order, so the test passed identically with the bug in place — it guarded nothing. It now hands the transport a `content-type` that differs from the fixture's and asserts the FIXTURE's value survives, so only one order can satisfy it. Non-vacuity checked rather than asserted: with the merge order flipped back the test fails on "the fixture's Content-Type must survive", and passes again when restored. * fix(storyboard): match brand.json on the PROTOCOL ENDPOINT, not the card base An A2A agent that publishes a conformant brand.json was graded non-conformant for publishing exactly what the spec asks for. security.mdx @ 3.1.1 :1142 step 1 defines `A`: "invoke `get_adcp_capabilities` via the agent's declared transport (MCP `tools/call` or A2A skill invocation) ... The agent URL is the PROTOCOL ENDPOINT, not a JSON capabilities document." Step 5 (:1104) then byte-equals `agents[].url` against that same `A`, explicitly without canonicalization. `probeBrandJwks` passed the URL the runner was handed. On MCP that IS the protocol endpoint, so this changed nothing there. On A2A it is not: the runner must be given the card's BASE, because the card lives at `<base>/.well-known/agent-card.json` and passing the RPC endpoint asks for `/a2a/.well-known/agent-card.json` (404). The endpoint `A` names is what the card resolves to. So a seller publishing `https://host/a2a` — the protocol endpoint, per the spec — got ZERO byte-equal matches against the base, and `selectAgentByUrl` correctly reported `agent_not_in_brand_json`. The resolver was right; it was being asked the wrong question. The A2A branch now resolves the card-named endpoint before matching, reusing `resolveA2aDispatchTarget` from this branch's dispatch path. It falls back to the handed URL rather than throwing: an unresolvable card is already reported by the dispatch path with its own reason, and raising here would relabel one failure as another. Measured against a live seller: brand.json publishes `.../a2a` and `.../mcp/`; mcp matched one entry, a2a matched none. The test asserts both directions — the base finds nothing, the protocol endpoint finds exactly one. * fix(storyboard): name the A2A legacy-compat policy, with the measurement behind it `a2a-dispatch.ts` hardcoded `legacyCompat: { enabled: true }` at two call sites. #2973 asked which of two things that means, and the answer decides whether the value is a defect or the only correct one. MEASURED against `@a2a-js/sdk`, one `cancelTask`, four combinations: | card | enabled | method emitted | a2a-version | |---------|---------|----------------|-------------| | 1.0 | true | CancelTask | 1.0 | | 1.0 | false | CancelTask | 1.0 | | 0.3.0 | true | tasks/cancel | 0.3 | | 0.3.0 | false | CancelTask | 1.0 | So `true` means "also accept 0.3", not "speak 0.3": a 1.0 card is never downgraded — the first two rows are byte-identical — and a 0.3 card gets the `tasks/*` family the AdCP spec names for it (security.mdx @ 3.1.1 :1045). `false` is the value that ignores the card: the last row is a 1.0 frame sent to an agent that published 0.3, silently. A conformance runner grades the agent the card describes, so the card-following policy is the only correct one at this layer, and it is deliberately not operator-configurable here: a knob that selected framing the agent never advertised would produce a verdict about an agent that does not exist. The two literals become one frozen, named constant so they cannot drift, and a test pins both directions of the measurement. #2973 keeps its broader scope — the library-wide default in `createNativeA2AClientFromCardUrl`, a CLI flag, and the runner guard. * fix(storyboard): harden official A2A signing dispatch * test(storyboard): expect actionable A2A dispatch remedy --------- Co-authored-by: Brian O'Kelley <[email protected]>
Summary
Salvages the independently valid content-digest grading correction from the original branch and rebases it onto current
main.An operator-selected verifier profile with
covers_content_digest: eithermust still grade vectors that test covered-request acceptance, digest mismatch, and malformed digest headers. Only vectors whose expected outcome depends on a stricterrequiredorforbiddenpolicy are excluded.Safety boundary
This branch deliberately drops the original live-capability wiring. The agent's advertisement is not the operator-selected verifier grading profile. Feeding the whole live
request_signingblock intoagentCapabilitylets an under-declaring agent suppress 39 of 40 vectors. Current main continues to read only the spec-definedprotocol_methods_required_forapplicability dimension from live capabilities.Verification
e1843665118c4f5b065b1b8710441c68b7ba376d)npm run buildNo merge requested; exact-head CI and review are required.