Repository navigation
Description
Found while vendoring the complete AdCP 3.1.1 request-signing vector set (#975). Reproductions are canonicalization.json cases, currently strict-xfail in tests/conformance/signing/test_canonicalization.py.
Problem
The spec requires signers to refuse to sign, and verifiers to reject, URLs whose authority is syntactically malformed:
If the authority has userinfo but no host (
https://user@/p), no host at all (https://:443/porhttps:///p), a bracketed host missing a closing bracket (https://[::1/p), or a bare IPv6 address outside brackets (https://fe80::1/p), the URL is malformed; signers MUST NOT sign it and verifiers MUST reject withrequest_target_uri_malformed.
—security.mdx,@target-uricanonicalization step 3
IPv6 zone identifiers (RFC 6874) MUST be rejected. ... verifiers MUST reject
@target-urivalues containing%25inside[...]withrequest_target_uri_malformed.
— ibid., step 2
canonicalize_target_uri() rejects only one of the six shapes. The rest are canonicalized into a well-formed-looking result and signed.
Failing cases
| case | input | expected | actual |
|---|---|---|---|
malformed-port-without-host |
https://:443/p |
reject | accepted as https:///p |
malformed-userinfo-without-host |
https://user@/p |
reject | accepted as https:///p |
malformed-empty-authority |
https:///p |
reject | accepted as https:///p |
malformed-bare-ipv6 |
https://fe80::1/p |
reject | accepted as https://fe80::1/p |
malformed-ipv6-zone-identifier |
https://[fe80::1%25eth0]/p |
reject | accepted unchanged |
malformed-ipv6-missing-closing-bracket |
https://[::1/p |
reject | ✅ rejected (ValueError) |
The first three collapse to an empty authority, so @authority enters the signature base as the empty string and @target-uri as https:///p. Two different malformed inputs (https://:443/p and https://user@/p) canonicalize to the identical base — signatures become transferable between them.
malformed-bare-ipv6 is a distinct hazard: _canon_authority() splits fe80::1 on the last colon, yielding host fe80: and port 1, then reassembles it as fe80::1. The round-trip masks the malformation.
request_target_uri_malformed is not implemented
The spec's error code for all of these does not exist anywhere in the SDK — src/adcp/signing/errors.py has no such constant, and grep -rn request_target_uri_malformed src/ is empty. It has its own row in the transport error taxonomy:
| Request
@target-uriis syntactically malformed (e.g., empty authority, bare IPv6, IPv6 zone identifier, raw non-ASCII host), OR canonicalized@authoritydoes not byte-match the authority component of the canonical@target-uri(cross-vhost replay) | No |request_target_uri_malformed|
Because the code is missing, the vendored test asserts only that canonicalization refuses (pytest.raises(ValueError)) rather than grading the code. That assertion should be tightened to the spec code once it exists.
Note on the taxonomy row
That same row also covers a second obligation the SDK does not appear to implement: canonicalized @authority must byte-match the authority component of the canonical @target-uri, and verifiers must derive @authority from :authority/Host rather than proxy state. The spec flags it as a cross-vhost replay defense. No vector in the 3.1.1 set exercises it, so it is not covered by the strict-xfail ledger — flagging it here rather than filing separately, since the fix lands in the same place.
Suggested direction
Reject the five shapes in _canon_authority(), add request_target_uri_malformed to the error taxonomy, and map the canonicalization refusal onto it at the verifier boundary.
Activity
bokelley commentedon Jul 28, 2026
Triage
Classification: Bug — spec-mandated rejections missing from canonicalization;
request_target_uri_malformederror code unimplementedBucket(s): signing (label absent from repo — gap noted)
Status: ready-for-human
Milestone: omitted
What the experts said:
webhook_target_uri_malformedtwin is mandatory in the same commit;REQUEST_TO_WEBHOOK_CODEwill silently not translate the new code if the webhook constant is omitted.@authority/Host-derivation gap (cross-vhost replay defense) is a distinct obligation requiringHostheader threading into_resolve_component— track separately; no 3.1.1 vector exercises it.errors.pyintocanonical.py— keepValueErrorin_canon_authority()(consistent with the existing unterminated-IPv6 case) and translate toREQUEST_TARGET_URI_MALFORMEDinside the verifier's existingexcept (ValueError, KeyError)block. Bare-IPv6 guard: check":" in hostafterrsplit(":", 1)on line 142-143 — the current branch mis-parsesfe80::1ashost="fe80:",port=1. Changing behavior of publiccanonicalize_target_uri/canonicalize_authority(both in__all__) is semver-relevant.My take: Clear conformance bug with a well-understood fix path and unanimous expert agreement. Flagged because (a) security-sensitive, (b) behavioral change to two public signing-API functions, and (c) the error taxonomy addition should get human sign-off given downstream consumers may key on error codes.
Implementation brief:
src/adcp/signing/errors.py: addREQUEST_TARGET_URI_MALFORMED = "request_target_uri_malformed"andWEBHOOK_TARGET_URI_MALFORMED = "webhook_target_uri_malformed"; addREQUEST_TARGET_URI_MALFORMED: WEBHOOK_TARGET_URI_MALFORMEDtoREQUEST_TO_WEBHOOK_CODEsrc/adcp/signing/canonical.py—_canon_authority()(lines 128–149): (1) after userinfo strip, raiseValueErrorif netloc is now empty; (2) in the[-branch, raiseValueErrorif%25appears inside[...]; (3) in theelif ":"branch, afterrsplit(":", 1), raiseValueErrorifhoststill contains:(bare IPv6); (4) after all branches, raiseValueErrorifhostis emptysrc/adcp/signing/verifier.py: in theexcept (ValueError, KeyError)catch, distinguish URI-malformation from other errors — either with aCanonicalUriError(ValueError)sentinel fromcanonical.py, or by catching the ValueError fromcanonicalize_target_uri/canonicalize_authorityseparately and mapping toREQUEST_TARGET_URI_MALFORMEDtests/conformance/signing/test_canonicalization.py: tighten xfail assertions for the five cases frompytest.raises(ValueError)to gradingexc.code == REQUEST_TARGET_URI_MALFORMEDonce the verifier translation is in place; PR test(signing): vendor the complete AdCP 3.1.8 request-signing vector set and pin it against drift #980 will have marked these strict-xfail ready for the fix to XPASS@authoritymust byte-match@target-uriauthority; derive fromHost/:authoritynot proxy state): out of scope for this fix — file separatelyPR #980 (open, fixing #975 test infrastructure) marks these five cases as
strict-xfail, so the changeset for this issue can land before or after #980 merges without conflict — the strict-xfail entry auto-retires on XPASS.Triaged by Claude Code. Session: https://claude.ai/code/${CLAUDE_CODE_REMOTE_SESSION_ID}
Generated by Claude Code
test(signing): assert the reject code, not just the refusal
fix(signing): add the webhook target-uri code and reject authorities …
test(signing): assert the reject code, not just the refusal
feat(signing): reject malformed authorities, convert IDN hosts to A-l…
fix(signing): add the webhook target-uri code and reject authorities …
fix(signing): reject malformed authorities, convert IDN hosts to A-la…
fix(signing): add the webhook target-uri code and reject authorities …
fix(signing): validate the port per RFC 3986 instead of trusting int()
test(signing): vendor the complete AdCP 3.1.8 request-signing vector …
fix(signing): reject malformed authorities, convert IDN hosts to A-la…
fix(signing): add the webhook target-uri code and reject authorities …
fix(signing): validate the port per RFC 3986 instead of trusting int()