Skip to content

Commit 5c6cf96

Browse files
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

‎package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
"staging:slice5:images-cpu": "tsx scripts/orbit-slice5-images-cpu-staging-e2e.ts",
3636
"orbit:import:verify": "tsx scripts/orbit-slice3-manifest.ts",
3737
"orbit:import:local": "tsx scripts/orbit-slice3-import.ts --local --database=orbit-v6-local --config=wrangler.test.jsonc",
38-
"test:d1": "tsx --test --test-concurrency=5 scripts/orbit-agent-identity-tests.ts scripts/orbit-api-contract-tests.ts scripts/orbit-handle-policy-tests.ts scripts/orbit-d1-tests.ts scripts/orbit-email-tests.ts scripts/orbit-mcp-authorization-tests.ts scripts/orbit-site-authorization-tests.ts scripts/orbit-public-page-tests.ts scripts/orbit-public-repository-tests.ts scripts/orbit-single-renderer-tests.ts scripts/orbit-style-scale-tests.ts scripts/orbit-slice1-tests.ts scripts/orbit-slice1-worker-tests.ts scripts/orbit-slice3-tests.ts scripts/orbit-slice4-tests.ts scripts/orbit-slice5-tests.ts",
39-
"test:d1:core": "tsx --test --test-concurrency=5 scripts/orbit-site-authorization-tests.ts scripts/orbit-mcp-authorization-tests.ts scripts/orbit-agent-identity-tests.ts scripts/orbit-api-contract-tests.ts scripts/orbit-handle-policy-tests.ts scripts/orbit-d1-tests.ts scripts/orbit-email-tests.ts scripts/orbit-public-page-tests.ts scripts/orbit-public-repository-tests.ts scripts/orbit-slice1-tests.ts scripts/orbit-slice1-worker-tests.ts scripts/orbit-slice3-tests.ts",
38+
"test:d1": "tsx --test --test-concurrency=5 scripts/orbit-agent-identity-tests.ts scripts/orbit-api-contract-tests.ts scripts/orbit-handle-policy-tests.ts scripts/orbit-d1-tests.ts scripts/orbit-email-tests.ts scripts/orbit-mcp-authorization-tests.ts scripts/orbit-site-authorization-tests.ts scripts/orbit-site-signin-e2e-tests.ts scripts/orbit-public-page-tests.ts scripts/orbit-public-repository-tests.ts scripts/orbit-single-renderer-tests.ts scripts/orbit-style-scale-tests.ts scripts/orbit-slice1-tests.ts scripts/orbit-slice1-worker-tests.ts scripts/orbit-slice3-tests.ts scripts/orbit-slice4-tests.ts scripts/orbit-slice5-tests.ts",
39+
"test:d1:core": "tsx --test --test-concurrency=5 scripts/orbit-site-authorization-tests.ts scripts/orbit-site-signin-e2e-tests.ts scripts/orbit-mcp-authorization-tests.ts scripts/orbit-agent-identity-tests.ts scripts/orbit-api-contract-tests.ts scripts/orbit-handle-policy-tests.ts scripts/orbit-d1-tests.ts scripts/orbit-email-tests.ts scripts/orbit-public-page-tests.ts scripts/orbit-public-repository-tests.ts scripts/orbit-slice1-tests.ts scripts/orbit-slice1-worker-tests.ts scripts/orbit-slice3-tests.ts",
4040
"test:d1:publication": "tsx --test scripts/orbit-slice4-tests.ts scripts/orbit-single-renderer-tests.ts scripts/orbit-style-scale-tests.ts",
4141
"test:d1:platform": "tsx --test scripts/orbit-slice5-tests.ts",
4242
"v6:check": "npm run test:d1 && npm run check && npm run worker:build",

0 commit comments

Comments
 (0)