From c01300be201525afd73d6ac3fcf19a2d8b74a65d Mon Sep 17 00:00:00 2001 From: CHarris Date: Sun, 19 Jul 2026 22:22:46 -0400 Subject: [PATCH] fix(ipc): never adopt an empty id from the main IPC (#15626) --- src/ipc.rs | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/ipc.rs b/src/ipc.rs index 68c987f4e..01f4cda6e 100644 --- a/src/ipc.rs +++ b/src/ipc.rs @@ -1689,19 +1689,24 @@ pub fn clear_trusted_devices() { } pub fn get_id() -> String { + // An empty id may come from a process that took over the main IPC with a + // config scope that has no id yet (e.g. a user GUI that became the server + // while the installed service was restarting). Treat it as no answer, + // otherwise the empty id is adopted below and wipes the local one. if let Ok(Some(v)) = get_config("id") { - // update salt also, so that next time reinstallation not causing first-time auto-login failure - if let Ok(Some(v2)) = get_config("salt") { - Config::set_salt(&v2); + if !v.is_empty() { + // update salt also, so that next time reinstallation not causing first-time auto-login failure + if let Ok(Some(v2)) = get_config("salt") { + Config::set_salt(&v2); + } + if v != Config::get_id() { + Config::set_key_confirmed(false); + Config::set_id(&v); + } + return v; } - if v != Config::get_id() { - Config::set_key_confirmed(false); - Config::set_id(&v); - } - v - } else { - Config::get_id() } + Config::get_id() } pub async fn get_rendezvous_server(ms_timeout: u64) -> (String, Vec) {