Repository navigation
OAuth for directory clients: confidential clients, refresh policy by client type (L-11) - #130
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 34 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
…client type (L-11) ChatGPT and Claude register from shared provider egress, so the 20/h per-IP DCR cap was effectively global per provider. Gemini needs persistent linking (the same refresh token back, expiry extended), and every refresh rotated with reuse revoking the grant, which also broke retrying clients. D5: split by standard OAuth client type. - DCR accepts client_secret_post/basic: an outer_cs_ secret, sha256 in oauthClient.clientSecret, returned once with no-store. AS metadata advertises the methods. CIMD and NULL-secret rows stay public. - Limits: DCR 120/h per IP + 300/h global; /oauth/authorize GET 120/h per IP (429, no request row). - /oauth/token authenticates confidential clients (Basic or post, constant-time on the hash) before claiming a code or touching a refresh row: a wrong secret burns nothing. - Public refresh rotates with a 30 s replay grace (identical pair, the concurrent loser replays instead of revoking; BEGIN IMMEDIATE). Confidential refresh is non-rotating and sliding, narrowing scopes. - Consent names what the grant can do and that it cannot touch billing. - outer oauth-client add registers a confidential client for consoles that take a client ID and secret (e.g. Gemini's Play Console). No migration: reuses Better Auth's clientSecret, tokenEndpointAuthMethod and rotationReplay* columns.
…t lookup and DCR insert errors
Security review (independent)Verdict: mergeable. Client authentication, ordering and the refresh state machine are correct. Verified:
Fixed in
Accepted tradeoffs (D5):
|
07377cb to
88196f7
Compare
|
CodeRabbit skipped this PR (out of free reviews). Reran the 13-check HTTP smoke on the final commit: all pass. Merging on green CI with the independent security review above. |
L-11 (owner decision D5: split by standard OAuth client type, not by platform).
Why:
Changes:
client_secret_post/client_secret_basic, issuing anouter_cs_secret; only its sha256 is stored, inoauthClient.clientSecret, and the 201 isno-store;["none","client_secret_post","client_secret_basic"];none; CIMD and existing rows stay public./oauth/authorizeGET 120/h per IP (429 withretry-after, no request row).rsplit_onceplus form decoding) or post, compared in constant time on the hash. This happens before a code is claimed or a refresh row is touched, so a wrong secret burns nothing: 401invalid_client, plus a Basic challenge when Basic was used.rotationReplay*columns). A concurrent loser replays instead of revoking. UsesBEGIN IMMEDIATE.expiresAtextended, scopes narrowed on the row. No reuse detection (accepted D5 tradeoff; controls are the 90-day idle expiry and revoke).offline_access.outer oauth-client add --name … --redirect-uri … [--auth …]: a confidential client for consoles that take a client ID and secret (Gemini's Play Console offers this when DCR isn't used). Rows areverified=1and exempt from the stale-DCR prune.percent-encodingis a new direct dependency (already in the lock).Departs from spec §6.1 ("DCR: public clients only", "refresh rotated on every use") per D5; the spec gets updated in the vault.
Tests: 8 new and 8 updated (see the commit). The concurrency tests passed 12 repeated runs.
Smoke on a real
outer serve, 13/13 passing:no-store;/mcp;