fix(colibri-vault): harden bw interaction — server-match fail-closed + serialize + note-key validation #100
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/colibri-vault-bw-hardening"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Hardens the
colibri-vaultcrate'sbwinteraction (the autonomous daemon provisioning path), bringing it to parity with — and slightly ahead of — theclawdie-vault-fetchshell helper (#69). Found during review of #69/#94.Changes
BW_SERVERserver-match, fail-closed. Previouslybw config serverwas?-propagated, so it hard-failed on the 2nd+ provision (bw stays authenticated between calls → "logout required"). Now it tolerates that refusal only if the already-configured server matches the expected endpoint; otherwise fails closed with a newVaultError::ServerMismatch. This both fixes repeat provisioning and stops a stale login from fetching against the wrong Bitwarden host — the same guard #69 added to the shell helper, which the daemon path lacked.bwkeeps process-global state (one configured server + session per process). Concurrent jailed spawns → concurrentprovision()→ could tear down each other's session mid-fetch. Wrapped the wholelogin→unlock→fetch→locklifecycle in a process-widetokio::sync::Mutex.validate_key; the secure-note path wrote rawKEY=VALUE. Now note keys are validated identically (no unchecked.envinjection from a note).Tests
cargo build -p colibri-vault✅,cargo test -p colibri-vault✅ (7 pass, incl. newserver_config_locked_detection_matches_bw_cli_textandvault_lock_serializes),cargo fmt --checkclean.Related
🤖 Generated with Claude Code