~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

pds-server: PAR keeps loopback client IDs as long as their parts allow

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/monolith:pds-server/loopback-client-id

PAR refused any client_id past 2048 bytes, so a loopback client asking for many permissions — the knotless CLI, whose ID is 2857 bytes — could not sign in at all. The cap is now 18470 bytes, the longest loopback ID whose redirect_uri and scope are each within their own caps.

Claude Opus 5.5 · low

What changes

Spec. spec/OAUTH.md, PAR step 17: a client_id longer than 18470 bytes is refused, with a note deriving it: http://localhost/?redirect_uri= (31) + &scope= (7) + 3 × (2048 + 4096), every byte of a redirect_uri at its cap and a scope at its cap percent-encoded. "How it is checked" says what is checked now.

Harness. harness/checks/oauth.mjs: PAR_FAULTS (compared with the reference, which keeps them) gains a loopback client_id whose scope is near 4096 bytes, one of exactly 18470 bytes, and knotless's CLI's own (2857 bytes, measured by printing client_id().len() from knotless's crates/knotless/src/oauth.rs; its scope is 2475 bytes), each kept; PAR_CAPS (the server held to the spec alone) refuses one of 18471 bytes in place of the old "over 2048" case. Each cites spec/OAUTH.md, "Pushed authorization requests", step 17.

Server. pds-server's too_large uses CLIENT_ID_CAP, computed as the spec derives it; par_field_caps tests 18470 and 18471.

Why

A loopback client's ID carries its scope (up to 4096) and redirect URIs (up to 2048), percent-encoded, so a 2048 cap refused requests whose every part was within its own cap. A bound is kept, rather than none as the reference has (up to its 100 KiB body), so what PAR keeps stays bounded.

How it was checked

node compare.mjs --steps 200 --seed 8 --only oauthParRefused,oauthDepartures: all agree; the reference keeps all three long IDs (knotless's in form and JSON). With the old cap of 2048 planted back in too_large, the same run fails at step 9: "OAuth: PAR refused: knotless's loopback client_id differs" (reference 201, server 400 invalid_request); put back. just quick: all 7 runs pass. Gates: the gates workflow on this pull.

Shortcomings

A loopback ID naming many redirect URIs can still pass 18470 bytes with each part within its cap; the bound covers one redirect_uri and one scope at their caps. The 18471 refusal was not planted against separately.

Approved

This raises PAR's client_id cap from 2048 to 18470 bytes. That is the longest loopback ID whose one redirect_uri and scope are each within their caps. I checked the arithmetic: 31 + 7 + 3 × (2048 + 4096) = 18470, and the Rust constant "http://localhost/?redirect_uri=&scope=".len() is 38, so it gives the same figure.

The change reaches the places the repository asks for:

  • the spec: step 17 and "How it is checked" in spec/OAUTH.md;
  • the harness: three kept cases in PAR_FAULTS compared with the reference, and an 18471-byte refusal in PAR_CAPS;
  • the server: CLIENT_ID_CAP and the updated par_field_caps test;
  • a changeset written for the people who call the server.

I found no other mention of the old cap in docs/. The harness cases are stricter than before and each cites the spec. The 2048 refusal was replaced by 18471 and nothing was loosened.

The pull's own caveat stands: an ID naming several redirect URIs can pass 18470 bytes with every part within its cap. The spec note says "one redirect_uri", so the claim is not overstated.

I did not run the gates. I read only the diff, not the surrounding harness code.

Merged as 0717fa4