Repository navigation
Commit 0830b4e
authored
fix(signing)!: apply canonicalization step 5 whatever the query does (#1456)
Step 5 of the AdCP URL-canonicalization algorithm substitutes `/` for an
empty path when an authority is present. `canonicalize_target_uri` gated
that on the query string as well, so `https://host` canonicalized to
`https://host` where the algorithm and RFC 3986 section 6.2.3 both require
`https://host/`. Only the queried spelling got its slash.
The gate was wrong on its own terms too: `https://host?` carries a `?` in
the raw URL but `urlsplit` reports an empty query, so the condition read
false and the output was `https://host?` -- a path-less URI no RFC 3986
normalizer produces.
`canonicalization.json` cannot detect either case. Of its 37 cases exactly
one has an empty path, and that one carries `?x=1`, which is why the
divergence passed 37/37.
The consequence reaches past request signing. This function is the
identifier comparer for `adagents.json` authorized_agents urls, `brand.json`
agents urls, the TMP seller agent url and the governance issuer, so a
publisher who registered an agent without a trailing slash did not match a
caller that arrived with one, and the refusal named authorization rather
than canonicalization.
On the identifier surfaces the new condition is strictly more permissive:
every input that received `/` before still does. On the signing path the
`@target-uri` base changes for the empty-path spellings, which is a wire
change, so the commit carries the breaking marker and the upgrade is
sequenced in `MIGRATION_v8_to_v9.md` and section 6 of
`docs/request-signing-migration.md`. Vector suite stays 37/37.
BREAKING CHANGE: `canonicalize_target_uri` returns `https://host/` for an
authority-only URL where it returned `https://host`, so the `@target-uri`
signature base changes for the bare-authority, non-default-port,
IPv6-literal, default-port and trailing-`?` spellings. A signer on this
release and a verifier on an earlier one derive different bases for the same
request, and verification fails with `request_signature_invalid`. Dial
signed clients at the explicit root path -- `https://host/` canonicalizes
the same way before and after, so both ends can then upgrade in any order --
or move an agent URL you cannot respell with its verifier in one window, or
hold the affected operation at `warn_for` across that window. Identifier
matching on `adagents.json`, `brand.json`, TMP `seller_agent.agent_url`,
`format-id.agent_url` and the governance issuer only becomes more
permissive: the two spellings converge, so a lookup that refused before can
now succeed and none that matched stops matching. Migration note:
`MIGRATION_v8_to_v9.md` and `docs/request-signing-migration.md` section 6.1 parent 0c7e8b8 commit 0830b4e
4 files changed
Lines changed: 114 additions & 1 deletion
File tree
- docs
- src/adcp/signing
- tests/conformance/signing
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
314 | 314 | | |
315 | 315 | | |
316 | 316 | | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
317 | 344 | | |
318 | 345 | | |
319 | 346 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
126 | 131 | | |
127 | 132 | | |
128 | 133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
264 | 264 | | |
265 | 265 | | |
266 | 266 | | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
0 commit comments