feat(be): revoke sessions from the user's own settings - #4246
Open
sea-snake wants to merge 1 commit into
Open
Conversation
|
✅ No security or compliance issues detected. Reviewed everything up to 154bb92. Security Overview
Detected Code Changes
|
sea-snake
force-pushed
the
feat/revoke-sessions-from-settings
branch
from
August 19, 2026 01:48
18fb88b to
34717f6
Compare
sea-snake
force-pushed
the
feat/revoke-sessions-from-settings
branch
from
August 19, 2026 02:57
34717f6 to
b8a64f9
Compare
sea-snake
force-pushed
the
feat/revoke-sessions-from-settings
branch
from
August 19, 2026 03:47
b8a64f9 to
90f092f
Compare
sea-snake
force-pushed
the
feat/revoke-sessions-from-settings
branch
from
August 19, 2026 06:28
90f092f to
2fba0ef
Compare
This was referenced Aug 19, 2026
sea-snake
force-pushed
the
feat/revoke-sessions-from-settings
branch
from
August 19, 2026 07:07
2fba0ef to
dcb3703
Compare
sea-snake
force-pushed
the
feat/revoke-sessions-from-settings
branch
from
August 19, 2026 08:17
dcb3703 to
d6d8557
Compare
sea-snake
force-pushed
the
feat/revoke-sessions-from-settings
branch
from
August 19, 2026 08:37
d6d8557 to
c78ef1a
Compare
sea-snake
force-pushed
the
feat/revoke-sessions-from-settings
branch
from
August 19, 2026 10:21
c78ef1a to
616f549
Compare
sea-snake
force-pushed
the
feat/revoke-sessions-from-settings
branch
from
August 20, 2026 10:57
616f549 to
1e76b12
Compare
sea-snake
force-pushed
the
feat/revoke-sessions-from-settings
branch
from
August 20, 2026 13:08
1e76b12 to
27cf6f4
Compare
sea-snake
force-pushed
the
feat/revoke-sessions-from-settings
branch
from
August 20, 2026 13:52
27cf6f4 to
1205a12
Compare
sea-snake
force-pushed
the
feat/revoke-sessions-from-settings
branch
from
August 20, 2026 15:24
1205a12 to
1389f4b
Compare
sea-snake
force-pushed
the
feat/revoke-sessions-from-settings
branch
from
August 20, 2026 16:10
1389f4b to
a55a18f
Compare
sea-snake
force-pushed
the
feat/revoke-sessions-from-settings
branch
from
August 20, 2026 17:24
a55a18f to
451b36d
Compare
sea-snake
force-pushed
the
feat/revoke-sessions-from-settings
branch
from
August 21, 2026 08:54
451b36d to
e7f2393
Compare
sea-snake
force-pushed
the
feat/revoke-sessions-from-settings
branch
from
August 21, 2026 10:38
e7f2393 to
0cce254
Compare
The app can sign out only its own session, so "sign this browser out" has to come from somewhere the anchor is authenticated. These two are authenticated by an anchor access method rather than by a session chain, and name sessions by locator rather than by principal, so the principal index stays on the app-facing path. Signing a browser out is an eager sweep of that anchor's references in one message, so refresh never has to read the anchor to find out whether its device was revoked: refresh happens every few minutes per active session, this happens rarely. The device record survives the sweep, so a browser that has been signed out is still one the user recognises and signing back in from it reuses the same id. Implements docs/ongoing/revocable-app-sessions.md §8.2, §9.3 (S16, S20). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
sea-snake
force-pushed
the
feat/revoke-sessions-from-settings
branch
from
August 21, 2026 17:06
0cce254 to
154bb92
Compare
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.
Design: #4224 (
docs/ongoing/revocable-app-sessions.md§8.2, §9.3 — S16, S20). Overview: #4230.Ships with #4249, which is the UI for it.
Motivation
An app can sign out only its own session (#4245), so "sign this browser out" has to come
from somewhere the anchor itself is authenticated. The two revocation surfaces are split by
what each caller can prove:
(origin, account, created_at), or a wholedevice_idChanges
revoke_account_sessiontakes(identity_number, origin, account_number, created_at).Two browsers signing in during the same round share a
created_at, so it can match morethan one; revoking both is the right outcome — the user named that moment at that account.
revoke_device_sessionstakes(identity_number, device_id)and sweeps that anchor'sreferences in one message, writing only rows that hold that device's sessions. Atomic,
with no partially-revoked state.
index — that stays on the app-facing path only.
it during refresh would make revocation O(1) but add an anchor read to a call that
otherwise never touches the anchor. Refresh happens every few minutes per active session;
this happens rarely.
one the user recognises, and signing back in from it reuses the same id. Deleting a device
record is a separate operation and is not specified here.
There is no session listing method, deliberately. A flat "every session of this anchor" call
returns a list bounded only by the caps and mixing every origin together. The right
decomposition is applications first, then sessions within one, and that wants designing
alongside whatever lists applications. Neither exists yet.
Tests
New
session_revocation_tests(5): signing a browser out sweeps every application, leavesanother anchor alone, writes nothing when there is nothing to revoke, revoking by creation
time covers same-round siblings, and revoking at an unknown origin is a no-op.
PocketIC (3): revoking one session from settings stops its refresh, revocation by another
anchor is
Unauthorized, and signing a whole browser out kills its sessions across twoapps while leaving a second browser working and leaving the device record listed.
All 770 canister unit tests pass, plus the
sessionssuite.