Skip to content

test(compliance): cover canonicalization step 5 for an empty path with no query - #8076

Merged
bokelley merged 2 commits into
adcontextprotocol:mainfrom
KonstantinMirin:fix/canonicalization-step5-empty-path-vectors
Oct 9, 2026
Merged

bokelley merged 2 commits into
adcontextprotocol:mainfrom
KonstantinMirin:fix/canonicalization-step5-empty-path-vectors

Conversation

@KonstantinMirin

@KonstantinMirin KonstantinMirin commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

The gap

Step 5 of the URL-canonicalization algorithm reads, in docs/reference/url-canonicalization.mdx:

5. Apply remove_dot_segments (RFC 3986 §5.2.4) to the path, but preserve consecutive slashes byte-for-byte. … If the path is empty AND an authority is present, substitute / (RFC 3986 §6.2.3; https://host?x=1 → https://host/?x=1).

The condition is "path empty AND authority present". The query appears only in the illustrative example.

test-vectors/request-signing/canonicalization.json has 37 cases, and exactly one has an empty path:

{
  "name": "empty-path-with-authority-becomes-slash",
  "rule": "step 5: empty path with authority → /",
  "input_url": "https://seller.example.com?x=1",
  "expected_target_uri": "https://seller.example.com/?x=1",
  "expected_authority": "seller.example.com"
}

That case carries ?x=1. So an implementation that reads the example as the condition — gating the substitution on the query rather than on the path and authority — scores 37/37 while diverging, emitting https://host for https://host where step 5 and RFC 3986 §6.2.3 both require https://host/.

This is not hypothetical. The Python SDK had precisely that gating (if not path and parts.query), and it passed the full published set:

vectors: 37   positive ok/bad 29/0   rejections ok/bad 8/0   FAILURES: 0

Since the set cannot distinguish the two readings, each new implementation is free to pick the wrong one and be told it conformed.

The four cases

No normative change — url-canonicalization.mdx is untouched, because the text is already correct. This is detection only.

name input expected @target-uri what it pins
empty-path-no-query-becomes-slash https://seller.example.com https://seller.example.com/ the condition is the path and the authority, not the query
empty-path-no-query-non-default-port-becomes-slash https://seller.example.com:8443 https://seller.example.com:8443/ the slash lands after the port; a fix applied to the host emits seller.example.com/:8443
empty-path-no-query-ipv6-becomes-slash https://[2001:db8::1] https://[2001:db8::1]/ brackets preserved per step 2, slash outside them
empty-path-empty-query-becomes-slash https://seller.example.com? https://seller.example.com/? steps 5 and 7 compose rather than compete

The last one is worth its place: it is where a query-gated reading fails on its own terms. The raw URL does carry a ?, but a parser reports the query as the empty string, so a condition written against the query reads false and the output is a path-less https://seller.example.com? — a form no RFC 3986 normalizer produces. Step 5 supplies the / and step 7 preserves the trailing ?.

Each case carries a rule naming the step it exercises and a $comment saying what a wrong implementation does instead, matching the conventions of the surrounding cases.

Why it matters beyond signing

The page's own "Where it applies" table makes this one algorithm the identifier comparer for adagents.json authorized_agents[].url, brand.json agents[].url, TMP seller_agent.agent_url, ProviderEntry.agent_url, format-id.agent_url and the governance-agent acceptance list. Under the query-gated reading:

canonicalize("https://agent.example.com") == canonicalize("https://agent.example.com/")
-> False

Two spellings of one URL become two identifiers. A publisher who registers an agent without a trailing slash does not match a caller that arrives with one, and the refusal reads as an authorization failure rather than a canonicalization one. On the signing path the same divergence shifts the @target-uri line of the signature base by one byte, which is the failure the vector README describes as the #1 silent 9421 interop bug.

Verification

Measured against the Python SDK with the step-5 condition corrected and with it left as-is:

proposed 41-case set positive rejections failures
against the query-gated implementation 29/4 8/0 4 — exactly the new cases
against the corrected implementation 33/0 8/0 0

In both runs the original 37 cases behave identically, so the addition is purely additive — it cannot change the verdict for an implementation that was already right. The four failures are all on expected_target_uri; expected_authority matches in every case, which is the cross-check on the authority values written here.

node scripts/check-changeset-protocol-scope.cjs origin/main and node scripts/lint-compliance-source-authority.cjs both pass. A patch changeset is included; dist/ is untouched, since the built bundles are generated and only frozen released versions are committed.

The companion SDK fix is proposed separately at https://github.com/adcontextprotocol/adcp-client-python/pull/1456. These vectors stand on their own, though — any implementation is free to be measured by them regardless of what that PR does.

Step 5 reads "If the path is empty AND an authority is present, substitute
`/`". The query is not part of that condition -- it appears only in the
step's illustrative example, `https://host?x=1` to `https://host/?x=1`.

The vector set could not tell the two readings apart. Of its 37 cases
exactly one had an empty path, and that one carried `?x=1`, so an
implementation that gated step 5 on the query passed 37 of 37 while
emitting `https://host` for `https://host`.

Four cases close it: the bare authority, a non-default port, an IPv6
literal, and the empty-query spelling where steps 5 and 7 compose to
`https://host/?`. Measured against the Python SDK, these four fail before
its step-5 fix and pass after it, with the original 37 green throughout.

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Approve

Approve — clean, purely-additive conformance-vector PR.

What I checked:

  • Adds four URL-canonicalization conformance vectors to canonicalization.json covering step 5 (empty path + authority → /) with no query present: bare authority, non-default port, IPv6 literal, and empty-query (https://host? → https://host/?, steps 5 + 7 composing).
  • Reviewer verified each expected_target_uri/expected_authority against url-canonicalization.mdx steps 2/4/5/7 — all correct.
  • No wire/normative change, docs already correct and untouched, no dist mutation, rule strings anchor to normative spec steps per DR-0001.
  • patch changeset is appropriate for a non-normative test-vector addition; no hardcoded vector count needs updating.

Decision-table walk: No critical/high/medium findings (row 1 N/A). gated_paths: false (row 2 N/A). high_risk: false (rows 3/5 N/A). No medium findings (rows 4/8 N/A). No prior escalation (row 6 N/A). No no-auto-approve team match (row 7 N/A). Falls through to row 9 → approve.

Note: review_decision is REVIEW_REQUIRED, but since gated_paths is false and no prose hard gate applies (no schema/normative/breaking change), this does not block approval.

@bokelley
bokelley merged commit 0b34c4b into adcontextprotocol:main Oct 9, 2026
51 checks passed
bokelley added a commit that referenced this pull request Oct 9, 2026
Add impressions-optional delivery rows (#8108) to the versioning
exceptions and migration guide, expected_confirmation_at on
refine_proposals (#8104), SDK implementation metadata (#8079),
unsupported-targeting-dimension details (#8052), experimental trust.json
schemas (#8067), the Reliable Reporting compaction notice and
REVISION_UNREADABLE (#8100, #8099), the sales-broadcast-tv 1.1.0
tightening (#8046), new signing and canonicalization vectors (#8068,
#8076), and training-agent fixtures (#8106, #8078, #8012). Regenerate
the In-review table from the 56 open 3.3.0 milestone issues.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants