Repository navigation
feat(web): the auth client posts JSON, and POST /auth/sign-out/ answers it (X06) - #130
Merged
Merged
Conversation
…(X06)
The stock app's sign-out menu posts a form to /auth/sign-out/ and follows the pin's
302 to the origin. Thrust's copy of the client posts JSON (D-022, confirmed), so the
route is the one D-022's answer for it: 200 `{"redirect_path": "/"}`, the session the
request holds ended, and both cookies cleared (`__Host-thrust_session` and
`__Host-thrust_csrf`, empty and `Max-Age=0`, with the attributes they are set with).
The inventory does not list the route; it is X06, as the static route is X05.
The pin's view catches every failure and answers the same redirect, a request with no
session included, so this answers one way whatever the request holds: no credential, an
unknown session cookie, a live session, one that has ended. An API key ends nothing
(a leaked key must not end the user's sessions, as the shared router's sign_out says),
and a cookie request needs the CSRF token where the deployment enforces it (403, and
nothing ended or cleared). It ends the one session it names, not the account's others.
thrust_api::cleared_cookies is public, as set_cookie and add_cookies are, so that the
compat routes spell the cookies as the shared router does.
Tests: a matrix over what a request can hold (none, an unknown cookie, a live session,
an ended one), each required to give the same answer with both cookies cleared, the
session it names ended and another account's untouched; an account signed in twice
keeps the other session. Three bugs planted one at a time each turn them red: the
session not revoked, the cookies not cleared, and every session of the account ended.
The contract suite, on all four targets, runs the cookie journey (the CSRF token's
refusal first, which ends nothing, then the sign-out, then the same again for an ended
session), and a bearer session, an API key and no credential at all; with the CSRF
failure ignored the first goes red and the guard reports 60 of 61. EXPECT_MAIN is 61.
Not here: the oracle's fixture and parity row (X06), the client change and D-036.
Refs: plane-byd.3
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The password form submits a native form post that the pin answers with a 302, and the
sign-out menu builds a form and submits it. Thrust answers JSON (D-022, confirmed;
sign-out is D-036), so the client now posts JSON and goes where the 302 would have gone.
Both files are the auth client, which Q-R2 allows to change.
apps/web/services/auth.service.ts: `passwordAuth(mode, data)` is new, a JSON post to
/auth/sign-in/ or /auth/sign-up/ that resolves with `{ redirect_path }` and rejects with
the server's `{ error_code, error_message, email }`. `signOut` posts JSON, with the CSRF
token it already fetched as the X-CSRFTOKEN header the double-submit check reads, and
navigates to the `redirect_path` it is answered.
apps/web/components/account/auth-forms/password.tsx: where the form was submitted
(`formRef.current.submit()`) it calls `passwordAuth` with the email, the password and the
`next_path` it was given. A success navigates to `redirect_path`. A refusal navigates to
`/?next_path=..&error_code=..&error_message=..&email=..`, which is what the pin's 302
would have carried and what `auth-root.tsx` already reads (`error_code`, `email`), so
nothing downstream of the form changes. An answer that is not the server's (a network
failure) leaves the form as it was and enabled again.
Not changed, and still the pin's: unique-code.tsx, reset-password.tsx and the OAuth hook,
whose server routes are not built, so the form post they make has no JSON answer to read;
and packages/services/src/auth/auth.service.ts, the same form-post sign-out in a service
this app does not use (`store/user` imports `@/services/auth.service`). web/ALLOWED-CHANGES
lists the two files that change and says so.
Checked here: `pnpm check:types` (react-router typegen, tsc --noEmit) has no errors,
oxfmt --check is clean on both files, and oxlint finds only the two autoFocus warnings of
the pin's own lines. The Q-R2 gate and the build run in CI's `web` job. Not run in a
browser yet; the journey of the next stage does.
Refs: plane-byd.3
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…checks The pin's POST /auth/sign-out/ is recorded as the last fixture of the journey: a live session (302 to the origin), the read after it that sends the session cookie the account held before (401), and a request with no session (302). The recorder checks first that the hand-sent cookie reads 200, so the 401 can only be the end of the session, and it now keeps a response header sent more than once (Set-Cookie) as a list in the raw exchange. No normaliser rule was needed; the 66 older fixtures are byte-identical. The replay projects the 302 onto Thrust's JSON as it does the sign-in's, and checks the two cookies itself, because the fixtures drop Set-Cookie. Two controls show the check can fail: a router that strips the sign-out's cookies, and one that answers a sign-out as it should and ends nothing (the read after it must then diverge). Refs: plane-byd.3 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…for both D-036 records the four ways POST /auth/sign-out/ differs from the pin (JSON for the 302, both cookies cleared on every answer, a 403 for a missing CSRF token where the pin renders a 200 page, no last-logout fields), with the cookie and CSRF facts read from the pin. It is pending owner confirmation. D-022 is marked confirmed by the owner on 2026-11-11. G-28 says what is recorded, what is read from the source, and what was only checked by hand in a real browser. PLAN.md and architecture/app.md no longer list the auth-client change as left. Refs: plane-byd.3 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
main moved by #127 and #129. Three conflicts, and three things the merge made necessary: - scripts/contract.sh: EXPECT_MAIN is 62 (main's 60, and the two sign-out contract tests). - status.md: main took G-28 (the acceptance list); the sign-out's row is G-29. PLAN.md keeps main's text and this branch's #44 sentence. - X06 joins the acceptance list (tools/compat-record/gen-acceptance.py EXTRA, regenerated acceptance.csv: 54 rows), since the list is now held to the fixtures and the recorder. POST /auth/sign-out/ is a route of the pinned inventory, which the generator checks. - tests/sign_out.rs carries the crate's test-code lint allowance, now that the panic lints apply to thrust-compat-plane (#129). Refs: plane-byd.3 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
aRustyDev
added a commit
that referenced
this pull request
Nov 12, 2026
`EXPECT_MAIN` is 65: main's 62 (the compat tests of #124, #127 and #130) and this branch's three. The deployed-Worker count of `stage2-contract.sh` is 59 (the six `oidc_` tests are skipped there), and the docs say so. The one conflict was that line of `scripts/contract.sh`, as at the last merge. Measured on native-memory after the merge: the main pass 65 of 65, the sweeper pass 3 of 3. Refs: #58 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #44 (the auth-client JSON change, and the sign-out it needs). Does not close it: serving the build and the
wrangler devjourney are the next PR, then the closing comment.What changes
Server (
thrust-compat-plane).POST /auth/sign-out/(X06; the sidebar's user menu calls it; the 48-row table does not list it, so it joins the acceptance list, now 54 rows) answers 200{"redirect_path": "/"}, ends the session the request names (cookie or bearer token), and clears both cookies on every answer. An API key ends nothing. While CSRF enforcement is on, a cookie request needs the token inX-CSRFTOKEN, and without it the answer is 403 and nothing is ended or cleared.thrust_api::cleared_cookiesis nowpubso the compat route spells the cookies the way the internal API does.Client (
web/, two files of the pin, Q-R2).components/account/auth-forms/password.tsx: the nativeform.submit()becomesauthService.passwordAuth(...), a JSON POST. On success it navigates toredirect_path; on a refusal it navigates to the same/?error_code=…&error_message=…&email=…the sign-in page already reads, so nothing downstream changes.services/auth.service.ts:signOutfetches the CSRF token, posts JSON with the header, and navigates toredirect_path.web/ALLOWED-CHANGESlists exactly those two files.Left at the pin on purpose:
unique-code.tsx,reset-password.tsx, the OAuth hook andpackages/services/src/auth/auth.service.ts. Their server routes (magic code, password reset, social login) are not built, so changing the client would only move the failure. This app's sign-out does not use the@plane/servicescopy.Record. X06 is recorded from the pin (a live session, the read after it with the old cookie, no session) and replayed through the D-022 projection. D-036 is new and pending your confirmation; D-022 is marked confirmed (2026-11-11). G-29 (the sign-out; main took G-28 for the acceptance list),
PLAN.mdandarchitecture/app.mdare updated. After the first push,mainmoved (#127, #129): I merged it, tookEXPECT_MAINto 62, added X06 toacceptance.csvthroughgen-acceptance.py(the list is now held to the fixtures and the recorder, so the fixture needed a row), and gavetests/sign_out.rsthe crate's test-code lint allowance.D-036 in one paragraph (details in
DEVIATIONS.md)The pin answers 302 to the origin, deletes only
session-id, leavescsrftokenalone, sets no cookie when there is no session, recordslast_logout_*, and answers a missing or wrong CSRF token with a 200 HTML page ("CSRF Verification Failed"). Thrust answers JSON, clears both its cookies every time, answers 403 for the token, and records no last logout. The cookie and CSRF facts were read from the pin's raw exchanges and a probe; the fixture format holds JSON bodies only, so the CSRF page is not recorded.Verified
cargo fmt --check,clippy --workspace --all-targets -D warningsand the wasm32 Worker clippy: clean.cargo nextest run --profile ci --workspace: 3539 passed after mergingmain(it includes the acceptance-list guard and the X06 row);cargo test --doc --workspace: passed;scripts/check-acceptance-list.sh,check-web-diff.sh,check-plane-500.sh,check-deps.shand the recorder self-test: ok.native-memory,native-pg,worker-memoryandworker-cf. After the merge,native-memoryonly: 62 passed, 62 expected (EXPECT_MAIN60 onmain, plus the two new tests). The other three cells have not been re-run since the merge; CI runs them.scripts/check-web-diff.sh: 3869 files, 2 differ, both allowed.pnpm -C webtypecheck andoxfmtclean, and the build contains the new code.GET /api/users/me/answering 401. The__Host-Securecookies work overhttp://127.0.0.1.Not verified
Needs your decision
D-036 (above). D-023, D-025 to D-029 and D-035 are still pending from earlier.
🤖 Generated with Claude Code