Repository navigation
Conversation
A desktop with the admin config file now signs in through the system browser and keeps each account's data to that account (#295). - Sign-in (RFC 8252): loopback redirect on 127.0.0.1, code flow with PKCE S256, state, nonce, acr_values, prompt=login and max_age. Both tokens are checked with platform-jwt, including the access claim (for example a group); no token is kept. A first sign-in that only set the authenticator app up asks for one more. - Binding: DatabaseManager gains an open guard. A database is bound to the first identity (issuer and subject) that opens it while signed in and refused for every other one; server workspaces stay closed. Without the config file no guard is installed and opens behave as before. - Lock: after idle time, the maximum session, screen lock or suspend, and by the toolbar button. The gate refuses at once, running jobs are cancelled, the database closes once no work runs and every copy of its key is dropped; finished jobs are forgotten. - requirePassphrase: no new key gets an OS wrap, so only passphrase-protected databases open on shared computer accounts. - Tests: an opt-in end-to-end test against a real Keycloak (VARLENS_E2E_KEYCLOAK_URL), which plays the browser through the development-build-only VARLENS_E2E_SIGN_IN_URL_FILE hook. - docs/guide/desktop-sign-in.md describes the setup for users and administrators. Spec: .planning/specs/2026-10-24-desktop-platform-sign-in.md
This was referenced Oct 29, 2026
robspan
marked this pull request as ready for review
October 29, 2026 10:25
This branch has not been deployed
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.
Third of three PRs for the desktop platform sign-in (#295). Based on #708 (auth mode and gate), which is based on #707; until the stack merges, only the last commit is this PR.
What
A desktop with the admin config file now signs in through the system browser and keeps each account's data to that account. Without the file nothing of this runs: no guard is installed and every open behaves as on
main.src/main/auth/platform-sign-in.ts,oidc-provider.ts,loopback-callback.ts): loopback redirect on127.0.0.1, code flow with PKCE S256, state, nonce,acr_values,prompt=login,max_age. Both tokens are checked withplatform-jwt, including the access claim (for example a group); no token is kept. A first sign-in that only set the authenticator app up asks for one more.database-binding.ts): a database is bound to the first identity (issuer and subject) that opens it while signed in and refused for every other one. Server workspaces stay closed in platform mode.session-lock.ts,DesktopAuth.lock): after idle time, the maximum session, screen lock or suspend, and by a toolbar button. The gate refuses at once, running jobs are cancelled, the database closes once no work runs, every copy of its key is dropped, and finished jobs are forgotten.requirePassphrase: no new key gets an OS wrap, so only passphrase-protected databases open on shared computer accounts.docs/guide/desktop-sign-in.mdfor users and administrators.Existing files touched
src/main/services/DatabaseManager.tssetOpenGuard:checkKeybefore a SQLite file is touched,checkSessionbefore any session becomes current; with a guard anAppErrorkeeps its message (without one every open failure is wrapped as before);lock()closes withcloseForLock, false while work runssrc/main/storage/sqlite/SqliteStorageSession.tscloseForLock(): the key goes first and new reads wait, so a writer or read pool respawned by a late call finds no key;close()is unchangedsrc/main/database/DatabaseService.tsdiscardKey()src/main/database/db-key-store-instance.tssetOsKeyWrapAllowed(false)forrequirePassphrase; existing wraps still unwrap, so the guard still recognises OS-unlockable keyssrc/main/services/auth/{AuthService,auth-writes}.tsdatabase_settings.platform_identity(INSERT OR IGNOREthrough the writer)src/main/services/jobs/JobRunner.tspruneTerminalJobs(keep)public: a lock forgets finished jobs, whose params name the account's filessrc/renderer/src/components/AppToolbar.vueauth:desktopSignIn,auth:desktopCancelSignIn,auth:desktopLock, desktop-onlydocs/.vitepress/config.mtsVerification
Against
mainat779a6d25, macOS arm64, Node 24.15.0, Electron 43, windows hidden:mainandrenderer), compared test by test withmain: no test changes status; 136 new tests pass.out/hashed file by file: as in feat(auth): desktop auth mode, access gate and admin config file #708, and inout/mainalso the shared chunk with the auth write operations and one chunk whoserequirelines of Node built-ins move.desktop-sign-in-keycloak.e2e.tsagainst a local Keycloak (opt-in viaVARLENS_E2E_KEYCLOAK_URL): enrolment, sign-in, lock, a second account kept off the first one's database, an account outside the access group refused. It plays the browser throughVARLENS_E2E_SIGN_IN_URL_FILE, a hook that works in development builds only.make lint-check,format-check,typecheck,agent-checkpass;make web-gate-static: 1131 passed, 1 expected failure, as onmain.Not covered yet (listed in the spec): the Windows ACL check has run against recorded descriptors only, not on a Windows host; settings shared by one computer account (recent databases, annotation author) are not tied to the identity yet.
Spec:
.planning/specs/2026-10-24-desktop-platform-sign-in.md.