vault provision: serialize bw access (mutex) to avoid concurrent-provision races #95
Labels
No labels
first-proof blocker
hardening
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: clawdie/colibri#95
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Problem
colibri-vaultnow does per-calllogin → unlock → fetch → lock(#94, #89). Butbwkeeps process-global state (one data dir / session per process). Concurrent jailed spawns trigger concurrentprovision()calls, which can interleave:bw locktears down a session another call is mid-fetchonlogin --apikey/unlockracing on the same bw stateResult: intermittent provision failures under concurrent spawns — hard to reproduce, easy to misdiagnose.
Fix
Serialize vault operations: wrap the per-call session lifecycle in a process-wide async
Mutex(e.g.tokio::sync::Mutexin aOnceLock) so only onelogin→unlock→fetch→lockruns at a time. Alternative: give each call an isolatedBITWARDENCLI_APPDATA_DIRso global state isn't shared — but a mutex is simpler for the MVP.Acceptance
Two provisions fired concurrently both succeed (no session torn down mid-fetch); a test spawning N concurrent
provision()calls against a stub passes deterministically.Context: #94 closed #89 without serialization — this is the deferred half of #89's trade-off note. Not OS-specific.
🤖 Generated with Claude Code