feat(desktop): auto-detect Linux keychain backend for secure token storage - #41236
feat(desktop): auto-detect Linux keychain backend for secure token storage#412363 commits merged into
Conversation
|
Thanks for addressing Linux secure token storage. The underlying gap is still present: Problems
Suggested changes
Automated hermes-sweeper review. |
…orage
On Linux, Electron's safeStorage requires the --password-store Chromium
switch to select the correct keychain backend. Without it,
isEncryptionAvailable() returns false, hardening.ts refuses to persist
remote gateway tokens, and users are forced back to the
HERMES_DESKTOP_REMOTE_URL / HERMES_DESKTOP_REMOTE_TOKEN env fallback.
- hermes_cli/main.py: _detect_linux_password_store() probes KDE session
env vars, GNOME Keyring's control socket, then a D-Bus ping of
org.freedesktop.secrets (covers any Secret Service implementation,
e.g. KeePassXC). The result is bridged into the desktop subprocess env
as HERMES_DESKTOP_PASSWORD_STORE for both source and packaged launches.
- The user override lives in config.yaml (desktop.password_store,
default "auto") rather than a new user-facing HERMES_* env var, per
AGENTS.md. An explicit HERMES_DESKTOP_PASSWORD_STORE env var still
wins over config and detection, matching desktop.disable_gpu
semantics.
- apps/desktop/electron/bootstrap-platform.ts:
resolveLinuxPasswordStore() validates the bridged value; main.ts
applies it via app.commandLine.appendSwitch('password-store', ...)
before app ready. Unknown values log a warning and are skipped.
- Tests: detector + bridging coverage (packaged and source launch
paths, config override, env-var precedence, linux-only gating) in
tests/hermes_cli/test_gui_command.py; resolver coverage in
bootstrap-platform.test.ts (vitest electron project).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
7824dfd to
66a2a4c
Compare
|
Reworked per the sweeper review — the branch is rebuilt on current main:
|
GottZ
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
Graph note (no action implied — a maintainer has already reviewed this thread).
Our triage graph places this PR in a complex with 1 related pull request (#65087). They were checked against each other at the diff level and no consolidation is indicated — they address distinct causes.
Full neighbourhood: https://hermes-triage.gottz.de/?node=41236
This note exists so the relationship stays discoverable from the thread itself.
Resolves conflicts from upstream's DEFAULT_CONFIG extraction into hermes_cli/config_defaults.py (password_store default moved there) and the test-pruning waves (dropped the pruned pre-existing launch-option tests; kept the new password-store tests). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
0c3f60f
…e_packaged_executable Main's helper no longer takes a platform kwarg (real-host layout since the sys.platform-fake removal); mark the five password-store tests linux_only/ macos_only per the don't-fake-the-host policy, and stub the Linux desktop-entry registration those cmd_gui runs now reach.
Problem
On Linux, Electron's
safeStoragerequires the--password-storeChromium switch to select the correct keychain backend. Without it,safeStorage.isEncryptionAvailable()returnsfalse,apps/desktop/electron/hardening.tsrefuses to persist remote gateway tokens, and Hermes Desktop silently falls back to requiringHERMES_DESKTOP_REMOTE_URL/HERMES_DESKTOP_REMOTE_TOKENenv vars for every remote gateway login.Solution
hermes_cli/main.py— adds_detect_linux_password_store()which probes (in order):KDE_SESSION_VERSION→kwallet6/kwallet5/kwalletKDE_FULL_SESSION→kwalletGNOME_KEYRING_CONTROL→gnome-libsecret(fast path, no subprocess)org.freedesktop.secrets→gnome-libsecret(covers GNOME Keyring, KeePassXC secret service, etc.)The result is bridged into the desktop subprocess env as
HERMES_DESKTOP_PASSWORD_STOREon Linux, for both the source (npm exec electron .) and packaged launch paths.User override via
config.yaml(not a new user-facingHERMES_*env var, perAGENTS.md):desktop.password_storejoins the existingdesktop.*launch options in_desktop_launch_options()."auto"(default) means detect; any ofgnome-libsecret/kwallet/kwallet5/kwallet6/basicforces a backend. Precedence matchesdesktop.disable_gpu: explicit env var > config > detection.apps/desktop/electron/bootstrap-platform.ts—resolveLinuxPasswordStore()validates the bridged value against the known-good set;main.tsapplies it viaapp.commandLine.appendSwitch('password-store', value)beforeappready. Unrecognised values log a warning and are skipped; non-Linux platforms ignore the variable entirely.Tests
tests/hermes_cli/test_gui_command.py: detector probes (KDE / GNOME / D-Bus / no-keychain), bridging on both packaged and source launch paths, config-override-skips-detection, env-var precedence, and linux-only gating.apps/desktop/electron/bootstrap-platform.test.ts(vitestelectronproject): valid backends applied, unset/blank no-op, non-Linux no-op, unknown values warn instead of apply.Impact
KDE_SESSION_VERSIONdesktop.password_storeset in config.yamlHERMES_DESKTOP_PASSWORD_STOREalready set