Repository navigation
Commit 5c6cf96
committed
Wire the site sign-in endpoints and prove the flow end to end
Fourth step of Plan 008: /authorize, /consent, /token, /userinfo, and the two
.well-known paths worker.ts rewrites into /v1. The flow now runs: consent
screen, code, token exchange, userinfo, refresh, revocation.
The end-to-end test found a real hole, which is the reason it exists. A
replayed refresh token was rejected but the chain was not burned: rotation
revokes the old token with reason 'rotated', and the status check ran before
the replay check, so presenting a stolen old token returned "no longer
valid" and left the legitimate new token working. That swallows the only
signal we get that a token leaked. The replay check now runs first and keys
off usedAt/replacedById rather than the revocation, so any second
presentation burns everything on that grant. Verified by the test that
caught it, which now fails on the old ordering.
The route ordering in /authorize matters as much as the checks. An unknown
client or an unlisted redirect URI never produces a redirect at all — the
person stays on Orbit and sees our page — because sending even an error to
an unverified address turns the endpoint into a courier for whatever address
an attacker names. Only after the address is confirmed does anything go back
to the site as error=.
A signed-out visitor is parked in a signed HttpOnly cookie rather than a
?next= parameter, and the Google callback and the registration response both
resume from it. The server only ever emits one fixed path for that resume,
so nothing reachable by a caller decides where a person lands after signing
in.
Scope requests that exceed what the client is registered for are refused
rather than trimmed, and a widened scope returns to the consent screen even
when a grant already exists. Silent re-authorization only happens when the
grant covers the request and the consent text version still matches.
Consent CSRF comes from the form, since the screen carries no JavaScript,
and is checked against the session's digest rather than the cookie alone.
182 core tests pass, including the 14 new end-to-end ones. The test client
is Equinox Rota with its real name and address; the signing key in
wrangler.slice1-test.jsonc is generated for tests and used nowhere else.1 parent 3a6ec8d commit 5c6cf96
11 files changed
Lines changed: 1670 additions & 9 deletions
File tree
- scripts
- src
- scripts
- server
- http
- identity
- repositories
- d1
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
39 | | - | |
| 38 | + | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
0 commit comments