Repository navigation
Let the owner sign out all browsers at once - #2080
Merged
Merged
Conversation
A browser session is a signed cookie with no server-side list, valid for the configured lifetime (seven days by default). There was no way to end a session early, for example after a phone is lost. That is needed before a Windows host can accept a browser on another device. `amplifier-unified browsers sign-out` saves a time in the owner's private configuration. It sends nothing over the network and uses no credential: the ability to write that private folder is the authority, so it also works while the host is stopped. A running host notices the record within about two seconds. It then refuses every session from before that time, drops pending sign-in tickets, and ends open state streams. All browser session checks now go through one function, `auth.valid_session`: the middleware and the two handlers that verified the cookie themselves. The saved time never moves backward, a failed save is an error, and a damaged record signs everyone out once and is repaired.
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.
Change
Problem. A browser session is a signed cookie with no server-side list. It stays valid for the configured lifetime (seven days by default). The owner had no way to end a session early, for example after a phone is lost. This is the first of two steps that let a browser on another device sign in to a Windows host; two independent security reviews of that design asked for this control before remote sign-in ships.
Result. One new owner command, on every platform:
config/auth/session-epoch). It sends nothing over the network and uses no credential. The ability to write that private folder is the authority, so it also works while the host is stopped.auth.watch_sessions; a cheap change hint, then a read through the private store). It then:device_pairing,device_connections) now callauth.valid_session. A test fails if another module verifies a session cookie on its own.No behavior change without the command. No record means no sign-out, and every valid session is accepted as before. Existing installations are not signed out by this update.
Owner.
amplifier_web/auth.py(record, check, watcher),server.py(starts and stops the watcher),cli.py(command).docs/DEPLOYMENT.mdhas a new section, "Sign out all browsers".Limits.
Validation
Local, Linux:
tests/test_session_sign_out.py: 12 passed. It covers the check at the boundary second, the monotonic time, the private record, the damaged record, the failed save, the running-host application with ticket and stream effects, the watcher surviving a fault, the real middleware, and the real command.tests/test_server_auth.py: a realcreate_apphost with a signed-in cookie and an open/api/eventsstream. After the command's write, the host notices by itself; the same cookie gets 401 for the API and a redirect to sign-in for a page; the open stream ends; a later sign-in works.test_server_auth,test_browser_entry,test_device_connections,test_device_pairing,test_windows_user_trial_probe,test_session_sign_out: 976 passed, 3 skipped. Alsotest_companion_authority,test_history_scope,test_host_pam,test_acp_server,test_tls_deployment,test_runtime_import_isolation: pass.Native Windows (this PR's
windows-local-connectioncheck):tests/test_session_sign_out.pyruns there on the real private store (record written and read through the owner-only ACL boundary, damaged record, real command).Not proven: a real browser on a real PC or phone being signed out. Linux
systemdand macOS hosts are covered by the same code and tests, not by a live check.