Commit be8944a
fix: address panel review findings on public OAuth2 clients
Addresses the first full panel review on #27873. Twenty findings; the
substantive ones:
The transaction test could not detect the regression it was written for.
Stubbing InTx to call the closure with the same mock made a call on tx and
a call on the outer store indistinguishable, so moving the secret insert
back outside the transaction kept it green. The closure now receives a
second mock, and an insert issued on the outer handle fails as an
unexpected call.
The server reported `token_endpoint_auth_method` from the stored column
while enforcing on `client_type`. Clients registered with "none" before it
was honored are stored confidential and still need their secret, so
reporting "none" told them to drop it. Report the method implied by the
enforced type instead, which also lets the row repair itself on the
client's next update.
An admin could mint a client secret for a public app. The token endpoint
never validates it, and deleting it revokes nothing, because a public
client's tokens carry a NULL `app_secret_id` rather than cascading from the
secret. The confidential kill switch silently did not exist for public
apps, so secret creation is now rejected for them.
The client type is a defined type with a single owner for the mapping from
auth method, and `client_type` is constrained at the schema level. It
decides whether client authentication runs at all, and the column accepted
any text. Redirect URI validation now derives publicness from the same
place registration does rather than re-deriving it.
PKCE verifiers are checked against RFC 7636 §4.1's 43 to 128 character
bound. For a public client the verifier is the only client authentication,
and a one-character verifier hashes to a well-formed challenge, so the
comparison alone could not tell a secret from a guess.
The rest: RFC 7592 rejections name the values compared and log, a public
client's exchange is tested with missing, wrong, and too-short verifiers,
`client_secret` absence is asserted against the raw body rather than a
decoded struct, `registration_client_uri` uses JoinPath so a trailing slash
in the access URL cannot double, and the public-client fixture is shared
instead of copied.
Docs and the token endpoint's swagger annotations described a
confidential-only world: both now cover public clients, including the
redirect URI schemes they cannot use.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 2b89218 commit be8944a
28 files changed
Lines changed: 492 additions & 182 deletions
File tree
- coderd
- apidoc
- database
- dbgen
- migrations
- oauth2provider
- oauth2providertest
- codersdk
- docs/admin/integrations
- site/src/api
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
15 | 16 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
23 | 29 | | |
24 | | - | |
25 | | - | |
| 30 | + | |
| 31 | + | |
26 | 32 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1732 | 1732 | | |
1733 | 1733 | | |
1734 | 1734 | | |
1735 | | - | |
| 1735 | + | |
1736 | 1736 | | |
1737 | 1737 | | |
1738 | 1738 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
690 | 690 | | |
691 | 691 | | |
692 | 692 | | |
693 | | - | |
| 693 | + | |
694 | 694 | | |
695 | 695 | | |
696 | 696 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
224 | 255 | | |
225 | 256 | | |
226 | 257 | | |
| |||
0 commit comments