Repository navigation
fix(auth): prevent stalled keyrings from hanging Linux commands - #805
Conversation
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
Authentication storage behavior depends on the still-unmerged basecamp/cli#79 concurrency and timeout implementation.
Review effort: Balanced
Findings: None
What changed in this PR
Bounds Linux keyring operations to prevent stalled D-Bus handshakes from hanging the CLI, with improved diagnostics, migration handling, documentation, and regression coverage.
Changes:
- Applies 10-second Linux keyring probe/operation limits through
basecamp/cli#79. - Preserves explicit fallback/error semantics across authentication, doctor, and migration.
- Documents and tests
BASECAMP_NO_KEYRING.
[!TIP]
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or rungh pr ready --undo.
Click "Ready for review" or rungh pr readyto reengage.
| File | Description |
|---|---|
SECURITY.md |
Documents keyring deadlines and plaintext fallback risks. |
nix/package.nix |
Updates the dependency vendor hash. |
go.mod |
Pins the reviewed credential-store implementation. |
go.sum |
Updates dependency checksums. |
internal/auth/keyring.go |
Configures Linux timeouts and improves timeout remedies. |
internal/auth/keyring_test.go |
Tests timeout configuration and errors. |
internal/auth/issue800_keyring_linux_test.go |
Reproduces the stalled D-Bus handshake. |
internal/commands/auth.go |
Adds credential-storage help. |
internal/commands/auth_status_agent_test.go |
Adapts agent diagnostic coverage. |
internal/commands/doctor.go |
Distinguishes unreadable credentials and bounds legacy lookup. |
internal/commands/doctor_test.go |
Covers doctor timeout and diagnostic behavior. |
internal/commands/migrate.go |
Bounds legacy keyring migration and honors bypass. |
internal/commands/migrate_test.go |
Tests migration timeout and bypass behavior. |
internal/cli/help.go |
Adds root credential-storage guidance. |
internal/cli/help_test.go |
Verifies override discoverability. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…or skip and remedy
…nd migrate comment
21451b8 to
590dacd
Compare
|
Rebased onto main at fe7738a and resolved the conflicts, preserving all eight original commits, including the regression-before-fix history. New head: 590dacd. Fresh verification:
The shared-library dependency remains pinned to 86242a69567b; basecamp/cli#79 is still open and must land first. The test/check claims in the original description refer to the old head unless superseded above. Nothing is merged and auto-merge is not armed. |
|
Fresh combined verification on e820556, now pinned to the final shared-library head afacf59fa6b6bb636ccdbe19900d9ae01934d3dd from basecamp/cli#79. The real binaries were run against an isolated simulated stalled password vault, using synthetic credentials only:
Full local bin/ci, credential race tests, all five release builds, and the Nix build pass. The Nix-built binary also runs. Shared-library and Fizzy compatibility checks pass; the fresh review found no new blockers in that scope. These results supersede the earlier-head verification notes. Still unverified: the originally affected desktop and live macOS/Windows vault behavior. The underlying desktop-service problem is not fixed; its ability to hang commands is bounded. Hosted checks are rerunning. Nothing merged; #79 still needs to land first. |
|
Holding this PR rather than merging: the final convergence check found 3 unresolved review threads. The initial stalled-vault reproduction and local checks pass, but later authentication/refresh failures can still give misleading login advice, and legacy deletion timeouts can be hidden by a migration completion marker. My earlier fresh-review summary did not account for these outstanding findings. They need explicit fixes or reasoned dispositions before merge. The shared-library dependency has now been merged in basecamp/cli#79; this PR and issue #800 remain open. |
|
Ready for merge review on 7082981: all three findings are fixed and all three review threads are resolved, with no unanswered findings. Copilot approved this exact head. Hosted CI accounts for all 41 checks: 36 successful, 4 conditionally skipped, 1 neutral, none failed or pending. The neutral check is Cubic, which could not review because its monthly quota is exhausted. Full local CI, focused doctor/migration race checks, 20 repeated runs of the new failure-path tests, all five release builds, the Nix build, and the original before/after stalled-vault reproduction pass. The full local command-package race attempt timed out, but all four hosted race shards and their aggregate pass on this head. The PR now uses the merged shared-library implementation. No regression was found in the checked paths. The originally affected desktop and live macOS/Windows credential-vault behavior remain unverified. Nothing merged in this follow-up. |

Summary
Fixes #800: Linux commands can hang indefinitely when the system password vault stops responding.
BASECAMP_NO_KEYRING, and withhold the completion marker when cleanup times out.Uses the merged shared-library change #79, pinned to c9bce820. The Nix vendor hash is updated and verified.
Verification
Current head:
70829810c5cf6b83f84aeecb0b45ff5f7598fb33.bin/cipasses.auth status,doctor, andmigrateeach remain hung until stopped after 14 seconds. Afterward they return in approximately 10, 20, and 10 seconds respectively; explicit bypass returns in 0.02–0.04 seconds.Limits
This prevents the reported hang; it does not repair the underlying desktop service. The originally affected desktop and live macOS/Windows vault behavior have not been retested. Interactive macOS/Windows timeout policy is unchanged.
Already-started keyring writes/deletes cannot be canceled and may complete after timeout. The affected store refuses further operations rather than allowing an unsafe retry. A Linux unlock prompt taking longer than the deadline can trigger the documented timeout behavior.