feat: add Bitwarden Password Manager provider#166
Conversation
Integrate Bitwarden Password Manager (bw CLI) as a secretspec provider. The provider supports vault-wide item access across all Bitwarden item types (Login, Card, Identity, SSH Key, Secure Note) with smart field extraction, URI-based configuration (bitwarden://[org@]collection?server=...&type=...&field=...), and session-based authentication via BW_SESSION. Co-Authored-By: deepseek-v4-pro <noreply@deepseek.com>
Upstream now ships a native BWS SDK provider (bws.rs), so the unified Password Manager + Secrets Manager provider must be reduced to Password Manager only. Remove the BitwardenService enum, BWS-specific config fields, execute_bws_command method, and bws:// scheme handling from register_provider! and TryFrom. Co-Authored-By: deepseek-v4-pro <noreply@deepseek.com>
Upstream's Provider trait has evolved from dynamic dispatch with (project, key, profile) signatures to a static-registration pattern with Address, ProviderUrl, and ProviderCredentials. Rewrite BitwardenConfig's TryFrom to accept &ProviderUrl, add convention_address/supported_coords/with_credentials/uri, and update get/set to accept Address<'_> parameters resolved via resolve_coords. Field resolution respects the native address coordinate first, then BITWARDEN_DEFAULT_FIELD, then config. Co-Authored-By: deepseek-v4-pro <noreply@deepseek.com>
Wire the bitwarden module into the provider registry with a bw feature flag (bw = ["dep:base64"], enabled by default). The base64 dependency encodes JSON for the bw CLI's item create/edit stdin path. Add four unit tests covering provider creation, collection, org-collection URI parsing, and bws:// scheme rejection. Co-Authored-By: deepseek-v4-pro <noreply@deepseek.com>
The bitwarden.md page was drafted for a dual-service (bw + bws) provider. Strip empty code blocks, the Secrets Manager access token section, and a stray bullet left behind after BWS content removal. Co-Authored-By: deepseek-v4-pro <noreply@deepseek.com>
Add .pi/ to .gitignore for pi-agent task output. The collapsible_if lint in config::migrate_macos_config is a pre-existing upstream warning surfaced by clippy during this branch's development. Co-Authored-By: deepseek-v4-pro <noreply@deepseek.com>
Replace the manual setup requirements with an auto-provisioning setup_test_data() function that creates Bitwarden items if they don't exist, and registers an EXIT trap to clean them up unless --keep-test-data is passed. Co-Authored-By: deepseek-v4-pro <noreply@deepseek.com>
Replace invalid TOML keys ("Deploy SSH Key", etc.) with valid
bw_integration_test_* identifiers and ref = { item, field }
mapping, matching the new Provider API address model.
Co-Authored-By: deepseek-v4-pro <noreply@deepseek.com>
Co-Authored-By: deepseek-v4-pro <noreply@deepseek.com>
Co-Authored-By: deepseek-v4-pro <noreply@deepseek.com>
Co-Authored-By: deepseek-v4-pro <noreply@deepseek.com>
The entry landed in the already-released 0.15.0 section during the rebase; the provider targets the next release.
The provider wraps the `bw` CLI, so the id now matches the tool it drives and the existing cargo feature, mirroring how the bws provider is named after the bws CLI. URIs change from bitwarden:// to bw://. The provider is unreleased, so there is no compatibility impact. Module, source file, and docs page follow the id (provider::bw, providers/bw.md). BITWARDEN_DEFAULT_TYPE/FIELD env vars keep their prefix to stay clear of the bw CLI's own BW_* namespace.
Add the Bitwarden Password Manager provider to every listing the adding-providers checklist names: sidebar and llms.txt description, concepts and reference tables (with security row), landing page metadata/hero/bento (provider count 14 -> 15), quick-start and README config-init examples, and the rustdoc provider summary. All entries carry the 0.16+ label; the provider page gains the version notice. The landing grid's existing plain 'Bitwarden' label becomes 'Bitwarden Secrets Manager' to disambiguate the two Bitwarden providers.
bw can prompt on stdin (e.g. for the master password when a session is missing or expired). stdin is null or closed on our invocations so a prompt could not hang us, but --nointeraction makes bw fail fast with its own clear error instead of a confusing EOF-related one, which matters in CI and other headless contexts.
|
Vaultwarden testing done, as promised on #15: the full And since you asked about automating it: I've opened ashebanow#2 against your branch implementing the FUTURE WORK plan from the script header — disposable Vaultwarden + fixture account, no repository secrets, fork-PR-friendly. Two gotchas discovered on the way, handled in the harness:
|
Adds a Bitwarden Password Manager provider (
bw://) backed by the officialbwCLI.This resumes the effort from #24 — the renewed discussion in #15 is what inspired picking this work back up. It starts from the Password Manager core of that PR and reworks it for today's codebase.
What's included
bw://provider shelling out to thebwCLI, with vault-wide access to all item types: logins, cards, identities, SSH keys, and secure notesbwmatches the CLI it drives and the cargo feature, mirroring howbws://is named after thebwsCLIbw://?type=login&field=username) andBITWARDEN_DEFAULT_TYPE/BITWARDEN_DEFAULT_FIELDenv vars (prefix kept clear of thebwCLI's ownBW_*namespace)ref = { item = "...", field = "..." }mapping insecretspec.toml, so secret keys stay valid identifiers while pointing at arbitrarily named vault itemsbw://org@collection) and self-hosted servers (?server=)secretspec setbwfailure modes: CLI not installed (with install instructions), not logged in, vault locked; secret values pass via stdin and the session via the environment, never argvbwcargo feature (default-enabled; adds only abase64dependency since the provider drives the CLI rather than linking an SDK)docs/providers/bw.mdwith 0.16 version notice) and all provider listings per the adding-providers checklist — sidebar, llms.txt description, concepts/reference tables, security table, landing page, quick-start, README — each labeled(0.16+)tests/bitwarden_integration.sh: end-to-end suite against a real vault covering all five item types,refmapping, env-var defaults, error paths, and set/update; auto-creates and cleans up its own test itemsbitwarden-cliadded to devenv for integration testingChanges relative to #24
bws://provider, so this PR is Password Manager onlyProviderUrl/AddressAPI and provider registrationrefmappingTesting
cargo test --allgreen locally (macOS)refmapping, env-var defaults, error handling, and set/update pathsNotes for reviewers
Refs #15 (inspiration for resuming), supersedes #24.
AI Note: this project's code and documentation were produced with the help of UI. The old pull request was developed with the help of Claude Code and Claude Opus/Sonnet, the additional work for this pull request was done using my custom pi environment and Deepseek v4 Pro/Flash.