Repository navigation
feat(vault): Bitwarden folder as a login provider through the bw CLI (desktop app) - #34
Merged
Merged
Conversation
added 2 commits
November 16, 2026 06:04
… desktop app only Unlock with the master password (on stdin), read one chosen folder, lock bw again at once. Items stay in memory until lock or restart. Folder ids checked as GUIDs, URI match rules honoured, only text/hidden custom fields as secrets, 2FA keys only filled.
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.
What changed
Adds Bitwarden as a second linked password manager next to 1Password, through the
bwCLI on the person's own computer.server/bitwarden.ts(new):BitwardenLogins implements VaultProvider, thebwrunner and the folder snapshot./api/logins/bitwarden:GET,DELETE,POST /unlock,POST /lock,PUT /folder,PATCH /bots.fill_loginfills Bitwarden logins (password plus TOTP). Bots can read the folder's secure notes and the custom fields of its logins as secrets.How an unlock works:
bw unlock --passwordfile /dev/stdin --raw(the master password is written to stdin)bw syncbw list foldersbw list items --folderid <chosen>bw lock, which always runs, infinallyThe session key lives for a few seconds and is dead once step 5 runs. The folder's items stay only in this process's memory until the person locks it or the app restarts.
Why
People who use Bitwarden instead of 1Password had no way to let bots sign in with their saved logins. A personal Bitwarden vault has no narrow, long-lived token like a 1Password service account, so this follows the design reviewed by DevilsAdvocate. It keeps the master password and session key out of reach of other processes run by the same user, and only ever loads one folder.
Security decisions:
bwexposes its env tops ewwfrom any process of the same user, and DevilsAdvocate reproduced this.BW_SESSIONandBW_PASSWORDinherited from the server are stripped. The session is put in the child's env only for the follow-up calls of a single unlock, and it is locked right after.nullandnotnullare refused, sincebwreads them as "every item without / with a folder"). They must also appear inbw list folders. Every returned item'sfolderIdis checked again."true"would be masked everywhere). The TOTP seed is only filled and never handed to a bot. Login notes, cards, identities and SSH keys are left out.[]) until the person picks some.desktopMutationTokenset, not cloud, not hosted, not Windows. Elsewhere the routes answer 404 and/api/loginsand/api/vaultstay exactly as before, with nobitwardenkey.bwstderr is classified and never echoed. Output is capped at 64 MB with a 60 s timeout.bwruns one call at a time.How it was verified
pnpm typecheck: pass.pnpm lint(oxlint --deny-warnings): pass. The pre-push guards (file-size ratchet, vocabulary) pass.server/bitwarden.test.ts, 15 tests:lockruns last even when listing failsspawnBwwith node): stdin is passed, and the inheritedBW_SESSION/BW_PASSWORDare strippedserver/routes/,server/host/,server/bot-logins,login-fill,onepassword,vault-store,secret-vault,src/components/VaultSettings,src/lib,src/i18n: 497 files, 6524 tests passed.bw2026.10.0 on macOS, logged in and locked, wrong master password, throughBitwardenLogins.unlock:ps -axww -E -o argswas sampled every 30 ms whilebwran (50 samples, argv and env). The password appeared 0 times.bw statusstayslockedafterwards.Before / After
Before (
mainec40eca): there is no Bitwarden provider at all.After (this branch):
Limits
bwdata folder. Unlocking or locking in the app also locks abwsession they have open in a terminal. The unlock dialog says so. SettingBITWARDENCLI_APPDATA_DIRin the server's environment gives the app its own folder, at the cost of a secondbw login./dev/stdin, and npm'sbw.cmdneeds a shell).Checklist
pnpm typecheckand the relatedpnpm testsuites pass locallydist-server/edits