Browser sessions get a vault: encrypted versioned payloads behind a named registry - #242
Open
czpython wants to merge 1 commit into
Open
Browser sessions get a vault: encrypted versioned payloads behind a named registry#242czpython wants to merge 1 commit into
czpython wants to merge 1 commit into
Conversation
…amed registry A browser session is now a first-class row — unique slug, status (needs_login / ready / stale), state format, and an active payload version. Payloads live as immutable AES-GCM envelope files under the data dir, one per version, authenticated against the session id and version so an envelope can't be replayed across sessions or versions. A write lands the envelope (0600 temp, fsync, rename) before a single compare-and-set UPDATE moves the active pointer; a crash on either side leaves an orphan file or an untouched pointer, and the startup reaper clears aged orphans and stray temp files. Uploads cap at 256 MB and log a warning from 200 MB. Mutation routes admit the session identity only, the same boundary as capability management; reads take the standard account dependency. There is no download route — state leaves the backend only into a sandbox. The settings modal gains a Browser sessions pane (list, create, rename, delete), and a bootstrap script captures a headed local login as storage_state and imports it through the API until the login window ships.
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 freeto 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.
What
Second phase of browser sessions as a druks primitive (stacked on #241). The vault: named sessions, encrypted versioned payload storage, the API and settings pane, and a bootstrap import path.
BrowserSession— unique slug, status (needs_login | ready | stale), state format (storage_state | profile_dir),active_version, site hint, refresh/use timestamps. Status transitions: create → needs_login, successful upload → ready.<data_dir>/browser_sessions/<id>/<version>.bin. AAD binds session id + version, so an envelope can't be replayed across sessions or versions. A write lands the file first (0600 temp → fsync → rename), then one compare-and-set UPDATE moves the active pointer; a concurrent writer loses the CAS and gets a typed conflict. The startup reaper removes aged orphan envelopes and stray temp files.scripts/import_browser_session.pyopens a headed local Chromium via playwright (not a druks dependency — the script degrades with install instructions), waits for the operator to log in, capturesstorage_state, and uploads it through the session-authed API. This makes sessions usable before the login window phase.Testing