You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Request-signing verifier skips checklist step 14: duplicate JSON keys are not rejected (request_body_malformed) #1264
The Python request-signing verifier (src/adcp/signing/verifier.py) doesn't implement AdCP request-signing checklist step 14 (strict body parse, request_body_malformed). grep -rn request_body_malformed src/adcp/signing finds nothing. The TypeScript SDK implements it: src/lib/signing/verifier.ts:323 throws request_body_malformed with "Signed request body is not strict JSON".
Why it matters
Checklist step 14a says a parser that keeps the first or last of two duplicate keys doesn't satisfy the step. Python's json.loads silently keeps the last duplicate. Take a body like {"method":"tools/call","params":{"name":"create_media_buy","name":"get_products"}}:
a gate that classifies the operation with json.loads sees get_products;
a downstream component that keeps the first value runs create_media_buy.
That can let a required_for operation run unsigned in mixed-parser deployments.
Found during the security review of the #7814 docs, adcontextprotocol/adcp. The docs example is being changed to parse strictly with an object_pairs_hook, but the SDK should enforce this itself.
Expected
After signature verification, and before returning success, the verifier parses the body strictly: duplicate keys at any depth, invalid UTF-8, or non-JSON cause a rejection with request_body_malformed at step 14, after step 13 has consumed the nonce.
The strictly parsed envelope is exposed so callers don't parse the body a second time.
Add the AdCP conformance vectors for step 14, if present in the compliance bundle, to the SDK's vector tests.
Target: adcp 8.0.0 stable (with AdCP 3.2.1), or 8.0.1.
security-reviewer: Real, non-speculative attack. Content-Digest covers raw bytes; a downstream parser that keeps the first duplicate key executes a different operation than the one the verifier authenticated. Rated high / ship-blocker; object_pairs_hook + request_body_malformed is the correct mitigation. Fix is bounded and TypeScript already ships it.
ad-tech-protocol-expert: Confirmed conformance bug — verifier.py docstring says "steps 1–13" and the generated spec enum (src/adcp/types/generated_poc/enums/request_signing_error_code.py:35) confirms request_body_malformed = 'request_body_malformed'. Important: REQUEST_TO_WEBHOOK_CODE in errors.py (line 130) must receive a matching entry or webhook routes will leak request-family error codes.
My take: Both experts converge and the fix path is clear, but because this is security-sensitive it needs @bokelley sign-off before a PR is opened. Two design choices need an answer first.
Activity
bokelley commentedon Sep 30, 2026
Triage
Classification: Bug (security)
Bucket(s): signing
Status: ready-for-human
What the experts said:
object_pairs_hook+request_body_malformedis the correct mitigation. Fix is bounded and TypeScript already ships it.verifier.pydocstring says "steps 1–13" and the generated spec enum (src/adcp/types/generated_poc/enums/request_signing_error_code.py:35) confirmsrequest_body_malformed = 'request_body_malformed'. Important:REQUEST_TO_WEBHOOK_CODEinerrors.py(line 130) must receive a matching entry or webhook routes will leak request-family error codes.My take: Both experts converge and the fix path is clear, but because this is security-sensitive it needs @bokelley sign-off before a PR is opened. Two design choices need an answer first.
Open questions for @bokelley:
VerifiedSignergainparsed_body: Any | None = Noneso callers avoid a second parse, or is that out of scope for 8.0.0?webhook_body_malformed? TheREQUEST_TO_WEBHOOK_CODEmap must carry a matching entry.Scope when authorized:
src/adcp/signing/errors.py— addREQUEST_BODY_MALFORMED = "request_body_malformed"+ webhook mirror +REQUEST_TO_WEBHOOK_CODEentrysrc/adcp/signing/verifier.py— add step 14 after nonce claim (line 433):object_pairs_hookparse; raise on duplicate keys, invalid UTF-8, or non-JSONTriaged by Claude Code. Session: https://claude.ai/code/session_01QxS4wQpFtddksojEJ4QYZ5
Generated by Claude Code
fix(signing): harden step-14 body parse per security review
fix(signing): keep lone surrogates out of strict-JSON source literals
fix(signing): reject non-strict-JSON signed bodies at checklist step …