Repository navigation
Make 2FA setup and revoke-all-sessions work - #111
Merged
Merged
Conversation
Two from the docs pass, both on the Account screen. Turning on 2FA failed every time. The server has required the account password to start enrolment since 0.5.0 and this client sent no body at all, so every attempt was a 422 and there was no way to add a second factor from the phone. Setup now asks for the password first. /auth/totp/setup also goes on TokenAuthenticator's no-retry list: a wrong password answers 401 there, and retrying it burns a refresh rotation and sends the same wrong password again, which the server counts twice towards the password lockout. "Revoke All Other Sessions" quietly did nothing. It posts to an endpoint that works out the caller's session from the `sheaf_session` cookie, which this client never sends, so every attempt came back 400 "No current session". It now revokes each handle in turn, which works with a bearer token. The endpoint is no longer declared, with a note saying why. That turned up a third one. The session list identifies the current session by cookie too, so the app already fell back to the `sid` claim from its own token, comparing it against the list's id. Those can never be equal: the raw id is the cookie credential, so every read surface returns sha256(id) truncated instead. The fallback was dead, the list had no "this session" at all, and revoke-all was asking the server to kill the session it was asking from, surviving only because the server refuses. The client now hashes the sid the same way, pinned to fixed digests so the two cannot drift silently. Verified on device: setup reaches a real secret and reports a wrong password without leaving the step; revoking took the account from 31 sessions to 3; the list now shows "THIS SESSION" with rename but no revoke.
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.
Two from the docs pass, both on the Account screen, plus a third they led to.
Turning on 2FA failed every time. The server has required the account password to start enrolment since 0.5.0 and this client sent no body at all, so every attempt was a 422 and there was no way to add a second factor from the phone. Setup now asks for the password first.
/auth/totp/setupalso goes on TokenAuthenticator's no-retry list: a wrong password answers 401 there, and retrying burns a refresh rotation and sends the same wrong password again, which the server counts twice towards the password lockout."Revoke All Other Sessions" quietly did nothing. It posts to an endpoint that identifies the caller's session from the
sheaf_sessioncookie, which this client never sends, so every attempt came back 400 "No current session". It now revokes each handle in turn, which works with a bearer token. The endpoint is no longer declared, with a note saying why.And a third, found on the way. The session list identifies the current session by cookie too, so the app already fell back to the
sidclaim from its own token and compared it against the list'sid. Those can never be equal: the raw id is the cookie credential, so every read surface returnssha256(id)truncated to 32 hex instead. The fallback was dead code, the list showed no "this session" at all, and revoke-all was asking the server to kill the session it was asking from, surviving only because the server refuses. The client now derives the handle the same way, pinned to fixed digests so the two cannot drift without a test failing.Verified on device: setup reaches a real secret and reports a wrong password without leaving the step; revoking took the account from 31 sessions to 3; the list now shows "THIS SESSION" with rename but no revoke.