Repository navigation
Description
Found while vendoring the complete AdCP 3.1.1 request-signing vector set (#975). Reproductions are newly vendored cases, currently strict-xfail.
Problem
@target-uri / @authority canonicalization in src/adcp/signing/canonical.py performs no IDN processing. _canon_authority() lowercases the host with str.lower() and returns it as-is:
host = host.lower()
if port is not None and port != _DEFAULT_PORTS.get(scheme):
return f"{host}:{port}"
return hostThe SDK already ships the correct helper — adcp.signing._idna_canonicalize.canonicalize_host() — and wires it into jwks.py, key_origins.py, ip_pinned_transport.py, revocation_fetcher.py and canonical_formats/references.py. canonical.py, the RFC 9421 signing path, is the one place that never calls it.
Consequence: a request to an IDN host signs and verifies over a signature base containing a raw non-ASCII host. A conformant counterparty computes the A-label base, so the two disagree and the signature fails to verify — the classic silent 9421 interop break.
Failing cases
canonicalization.json:
| case | input | expected @target-uri |
actual |
|---|---|---|---|
idn-to-punycode |
https://bücher.example/p |
https://xn--bcher-kva.example/p |
https://bücher.example/p |
idn-mixed-case-to-punycode |
https://BÜCHER.Example/p |
https://xn--bcher-kva.example/p |
https://bücher.example/p |
(@authority diverges identically: expected xn--bcher-kva.example, actual bücher.example.)
negative/026-non-ascii-host.json — the verifier side of the same gap:
- expected
request_signature_header_malformed, actualrequest_signature_invalidat step 10.
The spec is explicit that these are two different obligations. Signers MUST emit A-labels; verifiers MUST reject a raw U-label rather than silently re-normalize it:
A host containing raw non-ASCII bytes that has not been ToASCII-normalized by the signer MUST be rejected by the verifier; verifiers do not silently re-normalize.
—security.mdx,@target-uricanonicalization step 2
Processing mode matters
The spec pins the mode, because this is a known cross-language divergence:
UTS-46 Nontransitional processing with
CheckHyphens=true,CheckBidi=true,UseSTD3ASCIIRules=true,Transitional_Processing=false... theidnapackage — notstr.encode('idna'), which is IDNA2003
Worth confirming _idna_canonicalize.canonicalize_host() matches that pin before reusing it here.
Suggested direction
Call canonicalize_host() from _canon_authority() for the signer/base-construction path, and add a verifier-side rejection for authorities carrying raw non-ASCII bytes.
Activity
bokelley commentedon Jul 28, 2026
Triage
Classification: Bug
Bucket(s): signing (no
signinglabel exists in repo — noted as gap)Status: deferred
My take: The fix is clear and the SDK already ships the correct helper — PR #980 is the blocker, not the implementation. The conformance vectors that prove the fix (
canonicalization.jsonIDN cases +negative/026-non-ascii-host.json) exist only in PR #980's diff, not onmain; the xfail ledger entries there tie directly to this issue. Landing a fix here before #980 merges would either duplicate those files or ship without runnable spec-vector coverage.Blocked-on: #980 — resurfaces on merge
When #980 merges: the fix is a two-part change to
src/adcp/signing/canonical.pyandsrc/adcp/signing/verifier.py:_canon_authority(), replacehost = host.lower()with a call to_idna_canonicalize.canonicalize_host(host)(already imported by four other signing modules). The helper handles IP-literal short-circuit, FQDN-root dot stripping, and UTS-46 non-transitional processing with the flags the spec pins.request_signature_header_malformed(notrequest_signature_invalid) when the@authority/@target-urihost contains raw non-ASCII bytes — the spec explicitly requires rejection, not silent re-normalization.idn-*canonicalization cases andnegative/026.Triaged by Claude Code. Session: https://claude.ai/code/${CLAUDE_CODE_REMOTE_SESSION_ID}
Generated by Claude Code
fix(signing): add the webhook target-uri code and reject authorities …
feat(signing): reject malformed authorities, convert IDN hosts to A-l…
fix(signing): add the webhook target-uri code and reject authorities …
feat(signing): reject malformed structured-field input at step 1
fix(signing): reject malformed authorities, convert IDN hosts to A-la…
fix(signing): add the webhook target-uri code and reject authorities …
fix(signing): reject malformed structured-field input at step 1
fix(signing): reject malformed structured-field input at step 1
fix(signing): reject malformed authorities, convert IDN hosts to A-la…
fix(signing): add the webhook target-uri code and reject authorities …
fix(signing): reject malformed structured-field input at step 1
fix(signing): reject malformed structured-field input at step 1
fix(signing): reject malformed structured-field input at step 1 (#993)