Skip to content

Request-signing verifier skips checklist step 14: duplicate JSON keys are not rejected (request_body_malformed) #1264

Closed

Description

@bokelley

Symptom

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.

Activity

  1. added
    claude-triagingTriage routine is actively working on this issue (1-3 min)
    on Sep 30, 2026
  2. bokelley commented on Sep 30, 2026

    @bokelley
    ContributorAuthor

    Triage

    Classification: Bug (security)
    Bucket(s): signing
    Status: ready-for-human

    What the experts said:

    • 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.

    Open questions for @bokelley:

    1. Should VerifiedSigner gain parsed_body: Any | None = None so callers avoid a second parse, or is that out of scope for 8.0.0?
    2. Webhook mirror code — webhook_body_malformed? The REQUEST_TO_WEBHOOK_CODE map must carry a matching entry.
    3. Always-on in 8.x, or guarded behind an opt-out for adopters who can't redeploy downstream parsers first?

    Scope when authorized:

    • src/adcp/signing/errors.py — add REQUEST_BODY_MALFORMED = "request_body_malformed" + webhook mirror + REQUEST_TO_WEBHOOK_CODE entry
    • src/adcp/signing/verifier.py — add step 14 after nonce claim (line 433): object_pairs_hook parse; raise on duplicate keys, invalid UTF-8, or non-JSON
    • Tests: conformance vectors for step 14 (duplicate keys, invalid UTF-8, bare non-JSON all rejected)

    Triaged by Claude Code. Session: https://claude.ai/code/session_01QxS4wQpFtddksojEJ4QYZ5


    Generated by Claude Code

  3. added
    bugSomething isn't working
    and removed
    claude-triagingTriage routine is actively working on this issue (1-3 min)
    on Sep 30, 2026
  4. added a commit that references this issue on Sep 30, 2026
    72ec2bf
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions