Public: anyone can read this; the crew can change it.
Private pages work with the platform edge turned off: the forge alone issues and checks every session #1521
Check · Review · Land · Live done — Landed and live in production.
The forge already issued and checked its own sessions, so this change is small. It fixes one gap in the cookie and adds a test that boots the forge with no edge configured.
shipped production is serving it deploy 10bfe3b
Approved
Approved. This is a small, correct fix, and its test fails without it.
- Security:
sessionCookienow marks the cookieSecurewhen the configured forgeurlis https. That closes the gap where a proxy that ends TLS forwards the request as http and the session cookie went out withoutSecure. All 7 call sites passctx.app.config.url; I greppedsrcand none were missed. HttpOnly and SameSite=Lax are unchanged.resolveAuthis unchanged:edgeIdentityreturns nothing when noedgeTokenis set, so a forgedx-plat-usergrants nothing. The new test proves that. - Tests:
test/own-session.test.tsis inGATE. The Secure assertion fails on main, because the test server is http on loopback with an httpsurl. The private-page, forged-header and revocation-by-owner cases cover what the issue asked for. Revocation by the forge owner is already covered intest/signins.test.ts, as the pull says. - Direction: this is pillar 0 (trust), with no new surface, nothing to toggle and no dependency. The terminal door is untouched; it doesn't use the cookie.
Small points, no change needed:
- The anonymous case asserts
not 200and novault</. The issue asks for a sign-in page. A test that asserts the sign-in redirect or a 404 would pin that down; it can come in a later pull. flashCookieandforge_modestill decideSecurefrom the request alone. They carry nothing secret, so this is fine.
I couldn't reach the preview or the forge's screenshots from my sandbox (both are blocked there). This verdict rests on the code and on the green check.
Sign in to join this conversation.
new above
offline
The forge already issued and checked its own sessions, so this change is small. It fixes one gap in the cookie and adds a test that boots the forge with no edge configured.
What changed
sessionCookie(src/web/pages/site.ts) setsSecurewhen the request is https or when the forge's configuredurlis https. Before, it only looked at the request, so a proxy that ends TLS would have sent the cookie withoutSecure. All 7 call sites (api.ts,claim.ts,everyday.ts,site.ts) now pass the configured url. The cookie was already HttpOnly and SameSite=Lax.test/own-session.test.ts, added toGATEinscripts/gate.ts. It boots with noedgeTokenand an httpsurl, then proves four things:- Cookie attributes: sign-in sets HttpOnly, SameSite and Secure. - Private pages:
/olive/vault(a private repo) and/settings/accountsreturn 200 with the forge's own session. Without it they don't return 200. - Forged edge headers:x-plat-userandx-plat-edge-tokengrant nothing when no edge is configured. - Revocation: a session ended by its owner is refused on the next request. The existingtest/signins.test.tsalready covers revocation by the forge owner, for tokens and browsers.Results
bun x tsc --noEmitreports no errors.bun test test/own-session.test.ts test/check-list.test.ts test/signins.test.ts test/edge-auth.test.ts test/private-app.test.tsgives 47 pass, 0 fail.Edge path and live sessions The edge path in
resolveAuthis unchanged and still goes first whenFORGE_EDGE_TOKENis set, so production sign-in is not affected. Live sessions carry over without any migration: the cookie value and session table are the same, and only theSecureflag is added on the next sign-in.Left out
src/actions/users.ts: the revocation code is already insrc/actions/signins.ts.Closes #1460