Repository navigation
Web: a sign-out counts only when the BFF confirms it - #105
Merged
Merged
Conversation
logout() now sends POST /auth/logout with redirect: manual and reads the answer by the same rule as the pending-sign-out retry (logoutOutcome): a 204 or a 401 signed_out ends the session; any other 4xx or 5xx is a refusal and the page stays signed in; a redirect or another page's 2xx isn't the BFF's answer, so this device's data goes and the sign-out stays pending, as when there is no answer. Sign out after an expired session marks the sign-out pending and deletes this device's data at once, alongside the logout request, so a slow request can't leave the data on disk and a closed tab can't forget the server session may still be open. The manifest link carries crossorigin="use-credentials": a browser fetches the manifest without cookies otherwise, and behind Cloudflare Access that fetch gets the sign-in redirect. idb-storage imports DEADLINES_META rather than repeating the name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
signOut() set the pending-logout mark only after the request answered, up to the 30 s timeout. A tab closed in that window left a live cookie, the database not yet deleted and nothing pending, so the next visit was signed in with the data intact. The mark is now set before the request and cleared by a confirmed answer or a refusal (which leaves the page signed in). signOut() on a page whose session already expired goes through discardSaved(), since logout() would do nothing there. Tests: a logoutOutcome table, the pending mark during the request, a refused sign-out clearing it, Sign out after an expiry, discardSaved clearing pending after a 204; the close() test's fake answers 204. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Follow-up to #104 from its final review, before production.
logout()reads the BFF's answer by the same rule as the pending-sign-out retry (logoutOutcomeinsession.ts), withredirect: "manual":signed_outends the session;Before this change, a 200 from something other than the BFF ended the session with nothing pending. The session cookie could then sign the browser straight back in.
Sign out after an expired session marks the sign-out pending and deletes this device's data at once, alongside the logout request, instead of after it.
The manifest link carries
crossorigin="use-credentials". Without cookies, a manifest fetch behind Cloudflare Access gets the sign-in redirect and the app can't install. Potem Server spotted this on web-dev.idb-storage.tsimportsDEADLINES_METAinstead of repeating the string.Sign out is pending from the moment it starts (second commit, from the PR review):
signOut()set the pending mark only after the request answered, so a tab closed mid-request (up to 30 s) left a live cookie and nothing pending. It is now set before the request and cleared by a confirmed answer or a refusal. Sign out on a page whose session already expired goes throughdiscardSaved().Tests: 5 new (logout redirect mode, 401
signed_out, opaque redirect, a non-BFF 200, and a discard that doesn't wait on the request) plus a build test for the manifest attribute; each failed first. The test fake's logout now answers 204, as the real BFF does.pnpm testexit 0 (3684), five typechecks and leak-guard clean.🤖 Generated with Claude Code