From 986517ece61db6a445fb13a184c0909a6f367082 Mon Sep 17 00:00:00 2001 From: egdev6 Date: Fri, 20 Nov 2026 17:16:25 +0100 Subject: [PATCH 1/5] ci(linux): install libdbus-1-dev for the Secret Service keyring backend (#302) --- .devcontainer/README.md | 2 +- .devcontainer/setup.sh | 1 + .github/workflows/linux-ci.yml | 27 ++++++++++++------------- .github/workflows/linux-pr-ci.yml | 1 + .github/workflows/linux-release.yml | 1 + scripts/linux-release-workflow.test.mjs | 2 +- 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.devcontainer/README.md b/.devcontainer/README.md index 2f1345d6..52d58369 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -31,7 +31,7 @@ from any host: Windows (Docker Desktop / WSL2) or Linux directly. - Node 22 + Rust stable (official devcontainer features, no remote scripts) - Tauri 2 Linux system dependencies (`libwebkit2gtk-4.1-dev`, `libayatana-appindicator3-dev`, `librsvg2-dev`, `libsecret-1-dev`, - `patchelf`, `build-essential`, …) + `libdbus-1-dev`, `pkg-config`, `patchelf`, `build-essential`, …) - `xvfb` + `dbus-run-session` for the headless smoke - cargo/npm caches in named volumes (`quorb-cargo-home`, `quorb-npm-cache`), persistent across rebuilds diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh index 135f2fdf..962d60f3 100644 --- a/.devcontainer/setup.sh +++ b/.devcontainer/setup.sh @@ -17,6 +17,7 @@ sudo apt-get install -y --no-install-recommends \ file \ patchelf \ libwebkit2gtk-4.1-dev \ + libdbus-1-dev \ libxdo-dev \ libssl-dev \ libayatana-appindicator3-dev \ diff --git a/.github/workflows/linux-ci.yml b/.github/workflows/linux-ci.yml index 3515e9fb..0682a231 100644 --- a/.github/workflows/linux-ci.yml +++ b/.github/workflows/linux-ci.yml @@ -75,6 +75,7 @@ jobs: file \ patchelf \ libwebkit2gtk-4.1-dev \ + libdbus-1-dev \ libxdo-dev \ libssl-dev \ libayatana-appindicator3-dev \ @@ -127,20 +128,14 @@ jobs: run: timeout -k 10 600 xvfb-run -a cargo test --locked window_fit -- --ignored --nocapture # ---- W3 #106: Secret Service smoke (Linux real) ---- - # Los smokes `linux_secret_service_round_trip` y - # `linux_legacy_migrate_once_then_legacy_is_gone` (secrets.rs) están - # `#[ignore]` porque necesitan un Secret Service real (D-Bus + - # libsecret). Aquí se monta uno efímero: `dbus-run-session` crea un - # session bus aislado (y ya exporta DBUS_SESSION_BUS_ADDRESS) y - # `gnome-keyring-daemon --unlock` levanta el servicio con una contraseña - # de prueba propia del runner. - # El primero guarda/lee/borra un valor de prueba (backend `linux-native` - # del crate `keyring`); el segundo puebla el servicio LEGADO - # (es.egdev.ai-usage) y verifica que get() migra al destino actual, - # que el valor se reescribe y que el legado desaparece (criterio AC2). - # QUORB_SECRETS_SMOKE_ISOLATED=1 se define SOLO dentro de esta sesión - # aislada: el smoke de migración falla sin ella, así nunca toca un - # llavero real de un escritorio. + # Los smokes de secrets.rs están `#[ignore]` porque necesitan un + # Secret Service real. `dbus-run-session` crea un bus aislado y + # `gnome-keyring-daemon --unlock` levanta un servicio efímero. Además + # del round trip y la migración legacy, se comprueban la lectura de + # entradas keyutils antiguas, la persistencia y el borrado directamente + # en Secret Service, y el error explícito al faltar el servicio. + # QUORB_SECRETS_SMOKE_ISOLATED=1 solo se define en esta sesión aislada; + # todos los smokes comprueban la puerta antes de tocar el llavero. - name: Secret Service smoke (gnome-keyring, D-Bus session) run: | echo "► Arrancando Secret Service efímero (dbus-run-session + gnome-keyring)..." @@ -178,6 +173,10 @@ jobs: cd src-tauri echo "► Corriendo smoke linux_secret_service_round_trip (--ignored)..." cargo test --locked linux_secret_service_round_trip -- --ignored --nocapture + echo "► Corriendo smoke linux_secret_service_persistent_store (--ignored)..." + cargo test --locked linux_secret_service_persistent_store -- --ignored --nocapture + echo "► Corriendo smoke linux_secret_service_unavailable_is_error (--ignored)..." + cargo test --locked linux_secret_service_unavailable_is_error -- --ignored --nocapture echo "► Corriendo smoke linux_legacy_migrate_once_then_legacy_is_gone (--ignored)..." cargo test --locked linux_legacy_migrate_once_then_legacy_is_gone -- --ignored --nocapture echo " QUORB_SECRETS_SMOKE_ISOLATED=$QUORB_SECRETS_SMOKE_ISOLATED (aislamiento verificado)" diff --git a/.github/workflows/linux-pr-ci.yml b/.github/workflows/linux-pr-ci.yml index 9c2d188c..291f4ff9 100644 --- a/.github/workflows/linux-pr-ci.yml +++ b/.github/workflows/linux-pr-ci.yml @@ -54,6 +54,7 @@ jobs: file \ patchelf \ libwebkit2gtk-4.1-dev \ + libdbus-1-dev \ libxdo-dev \ libssl-dev \ libayatana-appindicator3-dev \ diff --git a/.github/workflows/linux-release.yml b/.github/workflows/linux-release.yml index 36592e63..33629b65 100644 --- a/.github/workflows/linux-release.yml +++ b/.github/workflows/linux-release.yml @@ -111,6 +111,7 @@ jobs: file \ patchelf \ libwebkit2gtk-4.1-dev \ + libdbus-1-dev \ libxdo-dev \ libssl-dev \ libayatana-appindicator3-dev \ diff --git a/scripts/linux-release-workflow.test.mjs b/scripts/linux-release-workflow.test.mjs index 5a1ca8dd..26c3a148 100644 --- a/scripts/linux-release-workflow.test.mjs +++ b/scripts/linux-release-workflow.test.mjs @@ -55,7 +55,7 @@ test('validated exact source is built and clean-container verified before same-r assert.match(build, /ref: \$\{\{ needs\.preflight\.outputs\.source_sha \}\}\n\s+path: source/); assert.match(build, /working-directory: source\n\s+run: npm ci/); assert.match(build, /working-directory: source\n\s+run: npm run app:build/); - for (const dependency of ['libwebkit2gtk-4.1-dev', 'libxdo-dev', 'libssl-dev', 'libayatana-appindicator3-dev', 'librsvg2-dev', 'libsecret-1-dev', 'libfuse2', 'xvfb', 'dbus-x11']) assert.ok(build.includes(dependency), dependency); + for (const dependency of ['pkg-config', 'libdbus-1-dev', 'libwebkit2gtk-4.1-dev', 'libxdo-dev', 'libssl-dev', 'libayatana-appindicator3-dev', 'librsvg2-dev', 'libsecret-1-dev', 'libfuse2', 'xvfb', 'dbus-x11']) assert.ok(build.includes(dependency), dependency); assert.match(build, /source\/src-tauri\/target\/release\/bundle\/deb\/Quorb_\$\{RELEASE_VERSION\}_amd64\.deb/); assert.match(build, /source\/src-tauri\/target\/release\/bundle\/appimage\/Quorb_\$\{RELEASE_VERSION\}_amd64\.AppImage/); assert.match(build, /docker build -t quorb-build-verify \.testcontainer/); From 14fa47f6836ba41589be57d32fb52ae8602ac8cc Mon Sep 17 00:00:00 2001 From: egdev6 Date: Fri, 20 Nov 2026 17:16:25 +0100 Subject: [PATCH 2/5] fix(linux): persist credentials in Secret Service with keyutils as cache (#302) --- src-tauri/Cargo.lock | 377 ++++++++++++++++++- src-tauri/Cargo.toml | 2 +- src-tauri/src/secrets.rs | 768 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 1129 insertions(+), 18 deletions(-) diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 164fde61..5b203803 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -8,6 +8,17 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures 0.2.17", +] + [[package]] name = "ahash" version = "0.8.12" @@ -305,6 +316,15 @@ dependencies = [ "generic-array", ] +[[package]] +name = "block-padding" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93" +dependencies = [ + "generic-array", +] + [[package]] name = "block2" version = "0.6.2" @@ -452,6 +472,15 @@ dependencies = [ "toml 1.1.6+spec-1.1.0", ] +[[package]] +name = "cbc" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" +dependencies = [ + "cipher", +] + [[package]] name = "cc" version = "1.6.0" @@ -526,6 +555,16 @@ dependencies = [ "windows-link", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + [[package]] name = "combine" version = "4.6.8" @@ -731,6 +770,24 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "dbus-secret-service" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "708b509edf7889e53d7efb0ffadd994cc6c2345ccb62f55cfd6b0682165e4fa6" +dependencies = [ + "aes", + "block-padding", + "cbc", + "dbus", + "fastrand", + "hkdf", + "num", + "once_cell", + "sha2", + "zeroize", +] + [[package]] name = "defmt" version = "1.1.1" @@ -811,6 +868,7 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", + "subtle", ] [[package]] @@ -1625,6 +1683,24 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "html5ever" version = "0.39.0" @@ -1917,6 +1993,16 @@ dependencies = [ "cfb", ] +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "block-padding", + "generic-array", +] + [[package]] name = "ipnet" version = "2.12.2" @@ -2160,8 +2246,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eebcc3aff044e5944a8fbaf69eb277d11986064cba30c468730e8b9909fb551c" dependencies = [ "byteorder", + "dbus-secret-service", "linux-keyutils", "log", + "secret-service", "security-framework 2.11.1", "security-framework 3.7.0", "windows-sys 0.60.2", @@ -2420,6 +2508,19 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" +[[package]] +name = "nix" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" +dependencies = [ + "bitflags 2.13.2", + "cfg-if", + "cfg_aliases", + "libc", + "memoffset", +] + [[package]] name = "nix" version = "0.31.3" @@ -2443,7 +2544,40 @@ dependencies = [ "mac-notification-sys", "serde", "tauri-winrt-notification", - "zbus", + "zbus 5.19.0", +] + +[[package]] +name = "num" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" +dependencies = [ + "num-bigint", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-complex" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" +dependencies = [ + "num-traits", ] [[package]] @@ -2452,6 +2586,36 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" +[[package]] +name = "num-integer" +version = "0.1.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c92800bd69a1eac91786bcfe9da64a897eb72911b8dc3095decbd07429e8048b" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" +dependencies = [ + "num-bigint", + "num-integer", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.19" @@ -2763,7 +2927,7 @@ checksum = "9cf20a545b305cf1da722b236b5155c9bb35f1d5ceb28c048bd96ca842f41b5b" dependencies = [ "android_system_properties", "log", - "nix", + "nix 0.31.3", "objc2", "objc2-foundation", "objc2-ui-kit", @@ -3201,13 +3365,24 @@ version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" +[[package]] +name = "rand" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + [[package]] name = "rand" version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41" dependencies = [ - "rand_chacha", + "rand_chacha 0.9.0", "rand_core 0.9.5", ] @@ -3222,6 +3397,16 @@ dependencies = [ "rand_core 0.10.1", ] +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + [[package]] name = "rand_chacha" version = "0.9.0" @@ -3232,6 +3417,15 @@ dependencies = [ "rand_core 0.9.5", ] +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", +] + [[package]] name = "rand_core" version = "0.9.5" @@ -3648,6 +3842,25 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "secret-service" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4d35ad99a181be0a60ffcbe85d680d98f87bdc4d7644ade319b87076b9dbfd4" +dependencies = [ + "aes", + "cbc", + "futures-util", + "generic-array", + "hkdf", + "num", + "once_cell", + "rand 0.8.8", + "serde", + "sha2", + "zbus 4.4.0", +] + [[package]] name = "security-framework" version = "2.11.1" @@ -3884,6 +4097,17 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "sha1" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "digest", +] + [[package]] name = "sha2" version = "0.10.9" @@ -4027,6 +4251,12 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "string_cache" version = "0.9.0" @@ -4467,7 +4697,7 @@ dependencies = [ "thiserror 2.0.21", "url", "windows", - "zbus", + "zbus 5.19.0", ] [[package]] @@ -4493,7 +4723,7 @@ dependencies = [ "tokio", "tracing", "windows-sys 0.61.2", - "zbus", + "zbus 5.19.0", ] [[package]] @@ -5879,6 +6109,16 @@ dependencies = [ "rustix", ] +[[package]] +name = "xdg-home" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec1cdab258fb55c0da61328dc52c8764709b249011b2cad0454c72f0bf10a1f6" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + [[package]] name = "xkeysym" version = "0.2.1" @@ -5908,6 +6148,38 @@ dependencies = [ "synstructure", ] +[[package]] +name = "zbus" +version = "4.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb97012beadd29e654708a0fdb4c84bc046f537aecfde2c3ee0a9e4b4d48c725" +dependencies = [ + "async-broadcast", + "async-process", + "async-recursion", + "async-trait", + "enumflags2", + "event-listener", + "futures-core", + "futures-sink", + "futures-util", + "hex", + "nix 0.29.0", + "ordered-stream", + "rand 0.8.8", + "serde", + "serde_repr", + "sha1", + "static_assertions", + "tracing", + "uds_windows", + "windows-sys 0.52.0", + "xdg-home", + "zbus_macros 4.4.0", + "zbus_names 3.0.0", + "zvariant 4.2.0", +] + [[package]] name = "zbus" version = "5.19.0" @@ -5938,9 +6210,22 @@ dependencies = [ "uuid", "windows-sys 0.61.2", "winnow 1.0.4", - "zbus_macros", - "zbus_names", - "zvariant", + "zbus_macros 5.19.0", + "zbus_names 4.3.4", + "zvariant 5.15.0", +] + +[[package]] +name = "zbus_macros" +version = "4.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "267db9407081e90bbfa46d841d3cbc60f59c0351838c4bc65199ecd79ab1983e" +dependencies = [ + "proc-macro-crate 3.5.0", + "proc-macro2", + "quote", + "syn 2.0.119", + "zvariant_utils 2.1.0", ] [[package]] @@ -5953,9 +6238,20 @@ dependencies = [ "proc-macro2", "quote", "syn 3.0.6", - "zbus_names", - "zvariant", - "zvariant_utils", + "zbus_names 4.3.4", + "zvariant 5.15.0", + "zvariant_utils 4.2.0", +] + +[[package]] +name = "zbus_names" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b9b1fef7d021261cc16cba64c351d291b715febe0fa10dc3a443ac5a5022e6c" +dependencies = [ + "serde", + "static_assertions", + "zvariant 4.2.0", ] [[package]] @@ -5966,7 +6262,7 @@ checksum = "d8bf88b4a3ff53e883001e0e0115b297a9d53c31b9c1edd2bfdd853e3428624e" dependencies = [ "serde", "winnow 1.0.4", - "zvariant", + "zvariant 5.15.0", ] [[package]] @@ -6024,6 +6320,20 @@ name = "zeroize" version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] [[package]] name = "zerotrie" @@ -6082,6 +6392,19 @@ version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" +[[package]] +name = "zvariant" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2084290ab9a1c471c38fc524945837734fbf124487e105daec2bb57fd48c81fe" +dependencies = [ + "endi", + "enumflags2", + "serde", + "static_assertions", + "zvariant_derive 4.2.0", +] + [[package]] name = "zvariant" version = "5.15.0" @@ -6093,8 +6416,21 @@ dependencies = [ "serde", "winnow 1.0.4", "zcheapstr", - "zvariant_derive", - "zvariant_utils", + "zvariant_derive 5.15.0", + "zvariant_utils 4.2.0", +] + +[[package]] +name = "zvariant_derive" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73e2ba546bda683a90652bac4a279bc146adad1386f25379cf73200d2002c449" +dependencies = [ + "proc-macro-crate 3.5.0", + "proc-macro2", + "quote", + "syn 2.0.119", + "zvariant_utils 2.1.0", ] [[package]] @@ -6107,7 +6443,18 @@ dependencies = [ "proc-macro2", "quote", "syn 3.0.6", - "zvariant_utils", + "zvariant_utils 4.2.0", +] + +[[package]] +name = "zvariant_utils" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c51bcff7cc3dbb5055396bcf774748c3dab426b4b8659046963523cee4808340" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", ] [[package]] diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index f228cd02..f8baf851 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -36,7 +36,7 @@ base64 = "0.22" # Lectura (solo lectura) de la sesión local de Cursor rusqlite = { version = "0.32", features = ["bundled"] } # Windows Credential Manager (y Keychain / Secret Service en otros SO) -keyring = { version = "3", features = ["windows-native", "apple-native", "linux-native"] } +keyring = { version = "3", features = ["windows-native", "apple-native", "linux-native-sync-persistent", "crypto-rust"] } # Solo Windows: registro (PATH fresco) y Job Objects (contención del árbol de procesos). [target.'cfg(windows)'.dependencies] diff --git a/src-tauri/src/secrets.rs b/src-tauri/src/secrets.rs index 6df6b9c6..f260f72a 100644 --- a/src-tauri/src/secrets.rs +++ b/src-tauri/src/secrets.rs @@ -90,10 +90,186 @@ fn is_known(key: &str) -> bool { } } +// keyring 3.6.3's persistent default builder constructs SsCredential rather +// than KeyutilsPersistentCredential. Use the crate's combined credential +// explicitly so existing keyutils-only entries remain readable. +#[cfg(target_os = "linux")] +struct LinuxPersistentBuilder; + +#[cfg(target_os = "linux")] +impl keyring::credential::CredentialBuilderApi for LinuxPersistentBuilder { + fn build( + &self, + target: Option<&str>, + service: &str, + user: &str, + ) -> keyring::Result> { + let combined = keyring::keyutils_persistent::KeyutilsPersistentCredential::new_with_target( + target, service, user, + )?; + let persistent = + keyring::secret_service::SsCredential::new_with_target(target, service, user)?; + Ok(linux_promoting_credential( + Box::new(combined), + Box::new(persistent), + target, + service, + user, + )) + } + + fn as_any(&self) -> &dyn std::any::Any { + self + } +} + +#[cfg(target_os = "linux")] +fn init_linux_keyring() { + static INIT: std::sync::Once = std::sync::Once::new(); + INIT.call_once(|| keyring::set_default_credential_builder(Box::new(LinuxPersistentBuilder))); +} + +// The combined backend reads existing keyutils entries but does not copy +// them to Secret Service. The same process-wide lock covers the cached read, +// promotion, writes and deletes, so an old read cannot undo a later mutation. +#[cfg(target_os = "linux")] +#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)] +struct LinuxCredentialId { + target: Option, + service: String, + user: String, +} + +#[cfg(target_os = "linux")] +type LinuxCheckedKeys = std::collections::BTreeSet; + +#[cfg(target_os = "linux")] +fn linux_checked_keys() -> std::sync::MutexGuard<'static, LinuxCheckedKeys> { + static CHECKED: std::sync::OnceLock> = + std::sync::OnceLock::new(); + CHECKED + .get_or_init(|| std::sync::Mutex::new(LinuxCheckedKeys::new())) + .lock() + .unwrap_or_else(|poisoned| poisoned.into_inner()) +} + +#[cfg(target_os = "linux")] +struct LinuxPromotingCredential { + combined: Box, + persistent: Box, + id: LinuxCredentialId, +} + +#[cfg(target_os = "linux")] +fn linux_promoting_credential( + combined: Box, + persistent: Box, + target: Option<&str>, + service: &str, + user: &str, +) -> Box { + Box::new(LinuxPromotingCredential { + combined, + persistent, + id: LinuxCredentialId { + target: target.map(str::to_owned), + service: service.to_owned(), + user: user.to_owned(), + }, + }) +} + +#[cfg(target_os = "linux")] +impl LinuxPromotingCredential { + fn promote_if_missing(&self, secret: &[u8], checked: &mut LinuxCheckedKeys) { + if checked.contains(&self.id) { + return; + } + let completed = match self.persistent.get_secret() { + Ok(_) => true, + Err(keyring::Error::NoEntry) => self.persistent.set_secret(secret).is_ok(), + Err(_) => false, + }; + if completed { + checked.insert(self.id.clone()); + } + } + + fn write(&self, write: impl FnOnce() -> keyring::Result<()>) -> keyring::Result<()> { + let mut checked = linux_checked_keys(); + let result = write(); + if result.is_ok() { + checked.insert(self.id.clone()); + } else { + checked.remove(&self.id); + } + result + } +} + +#[cfg(target_os = "linux")] +impl keyring::credential::CredentialApi for LinuxPromotingCredential { + fn set_password(&self, password: &str) -> keyring::Result<()> { + self.write(|| self.combined.set_password(password)) + } + + fn set_secret(&self, secret: &[u8]) -> keyring::Result<()> { + self.write(|| self.combined.set_secret(secret)) + } + + fn get_password(&self) -> keyring::Result { + let mut checked = linux_checked_keys(); + let password = self.combined.get_password()?; + self.promote_if_missing(password.as_bytes(), &mut checked); + Ok(password) + } + + fn get_secret(&self) -> keyring::Result> { + let mut checked = linux_checked_keys(); + let secret = self.combined.get_secret()?; + self.promote_if_missing(&secret, &mut checked); + Ok(secret) + } + + fn delete_credential(&self) -> keyring::Result<()> { + let mut checked = linux_checked_keys(); + let result = self.combined.delete_credential(); + if matches!(&result, Ok(()) | Err(keyring::Error::NoEntry)) { + // Keyutils can briefly return an invalidated key after deletion. + // Keep a tombstone so such a read cannot recreate it in Secret Service. + checked.insert(self.id.clone()); + } else { + checked.remove(&self.id); + } + result + } + + fn get_attributes(&self) -> keyring::Result> { + self.combined.get_attributes() + } + + fn update_attributes( + &self, + attributes: &std::collections::HashMap<&str, &str>, + ) -> keyring::Result<()> { + self.combined.update_attributes(attributes) + } + + fn as_any(&self) -> &dyn std::any::Any { + self.combined.as_any() + } + + fn debug_fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + self.combined.debug_fmt(f) + } +} + fn entry(key: &str) -> Result { if !is_known(key) { return Err(format!("Clave desconocida: {key}")); } + #[cfg(target_os = "linux")] + init_linux_keyring(); keyring::Entry::new(crate::channel::current().identifier, key).map_err(|e| e.to_string()) } @@ -311,6 +487,8 @@ mod tests { } } let store = Arc::new(Mutex::new(Store::default())); + #[cfg(target_os = "linux")] + init_linux_keyring(); keyring::set_default_credential_builder(Box::new(Builder(store.clone()))); let key = ( crate::channel::current().identifier.to_string(), @@ -333,6 +511,9 @@ mod tests { Err("No se pudo leer la clave de Resend del almacén seguro".into()) ); assert_eq!(store.lock().unwrap().data, before); + let err = set(RESEND_API_KEY, "rejected-test-value").unwrap_err(); + assert!(!err.contains("rejected-test-value")); + assert_eq!(store.lock().unwrap().data, before); } assert!(store.lock().unwrap().calls.iter().all(|k| k == &key)); store.lock().unwrap().failure = 0; @@ -351,6 +532,444 @@ mod tests { assert!(!store.lock().unwrap().data.contains_key(&key)); } + #[cfg(target_os = "linux")] + #[test] + fn linux_entries_use_keyutils_with_secret_service_persistence() { + let e = entry(OPENROUTER_API_KEY).expect("entry Linux"); + assert!(e + .get_credential() + .is::()); + } + + #[cfg(target_os = "linux")] + mod linux_promotion { + use super::*; + use keyring::credential::{Credential, CredentialApi, CredentialBuilderApi}; + use std::sync::{Arc, Mutex}; + + #[derive(Default)] + struct Store { + cache: Option>, + persistent: Option>, + read_attempts: usize, + write_attempts: usize, + fail_persistent_read: bool, + fail_persistent_write: bool, + pause: Option, + } + + #[derive(Clone, Copy, PartialEq, Eq)] + enum PausePoint { + CombinedRead, + PersistentRead, + } + + struct Pause { + point: PausePoint, + reached: std::sync::mpsc::Sender<()>, + resume: std::sync::mpsc::Receiver<()>, + } + + enum Backend { + Combined, + Cache, + Persistent, + } + + struct Item { + store: Arc>, + backend: Backend, + } + + impl CredentialApi for Item { + fn set_secret(&self, value: &[u8]) -> keyring::Result<()> { + let mut store = self.store.lock().unwrap(); + match self.backend { + Backend::Persistent => { + // Only direct promotion writes count here, not writes + // delegated to the combined backend. + store.write_attempts += 1; + if store.fail_persistent_write { + return Err(keyring::Error::Invalid( + "store".into(), + "unavailable".into(), + )); + } + store.persistent = Some(value.to_vec()); + } + Backend::Combined => { + store.cache = Some(value.to_vec()); + store.persistent = Some(value.to_vec()); + } + Backend::Cache => store.cache = Some(value.to_vec()), + } + Ok(()) + } + + fn get_secret(&self) -> keyring::Result> { + let mut store = self.store.lock().unwrap(); + let (result, point) = match self.backend { + Backend::Persistent => { + store.read_attempts += 1; + let result = if store.fail_persistent_read { + Err(keyring::Error::Invalid( + "store".into(), + "unavailable".into(), + )) + } else { + store.persistent.clone().ok_or(keyring::Error::NoEntry) + }; + (result, Some(PausePoint::PersistentRead)) + } + Backend::Combined => ( + store + .cache + .clone() + .or_else(|| store.persistent.clone()) + .ok_or(keyring::Error::NoEntry), + Some(PausePoint::CombinedRead), + ), + Backend::Cache => (store.cache.clone().ok_or(keyring::Error::NoEntry), None), + }; + let pause = if store.pause.as_ref().map(|p| p.point) == point && point.is_some() { + store.pause.take() + } else { + None + }; + drop(store); + if let Some(pause) = pause { + pause.reached.send(()).unwrap(); + pause + .resume + .recv_timeout(std::time::Duration::from_secs(5)) + .expect("el controlador debe liberar la lectura"); + } + result + } + + fn delete_credential(&self) -> keyring::Result<()> { + let mut store = self.store.lock().unwrap(); + let value = match self.backend { + Backend::Combined => { + store.cache.take(); + store.persistent.take() + } + Backend::Cache => store.cache.take(), + Backend::Persistent => store.persistent.take(), + }; + value.map(|_| ()).ok_or(keyring::Error::NoEntry) + } + + fn as_any(&self) -> &dyn std::any::Any { + self + } + } + + struct Builder { + store: Arc>, + key: &'static str, + } + + impl CredentialBuilderApi for Builder { + fn build( + &self, + target: Option<&str>, + service: &str, + user: &str, + ) -> keyring::Result> { + assert_eq!(target, None); + assert_eq!(service, crate::channel::current().identifier); + assert_eq!(user, self.key); + Ok(super::super::linux_promoting_credential( + Box::new(Item { + store: self.store.clone(), + backend: Backend::Combined, + }), + Box::new(Item { + store: self.store.clone(), + backend: Backend::Persistent, + }), + target, + service, + user, + )) + } + + fn as_any(&self) -> &dyn std::any::Any { + self + } + } + + fn run_in_child(name: &str) -> bool { + const CHILD: &str = "QUORB_LINUX_PROMOTION_MOCK_CHILD"; + if std::env::var_os(CHILD).is_some() { + return false; + } + let result = std::process::Command::new(std::env::current_exe().unwrap()) + .args(["--exact", name]) + .env(CHILD, "1") + .output() + .expect("iniciar proceso aislado para el builder global"); + assert!( + result.status.success(), + "stdout: {}\nstderr: {}", + String::from_utf8_lossy(&result.stdout), + String::from_utf8_lossy(&result.stderr) + ); + assert!(result.stderr.is_empty()); + true + } + + fn fixture(key: &'static str) -> (Arc>, keyring::Entry, keyring::Entry) { + let store = Arc::new(Mutex::new(Store::default())); + super::super::init_linux_keyring(); + keyring::set_default_credential_builder(Box::new(Builder { + store: store.clone(), + key, + })); + let cache = keyring::Entry::new_with_credential(Box::new(Item { + store: store.clone(), + backend: Backend::Cache, + })); + let persistent = keyring::Entry::new_with_credential(Box::new(Item { + store: store.clone(), + backend: Backend::Persistent, + })); + (store, cache, persistent) + } + + #[test] + fn missing_secret_service_value_is_promoted_once() { + if run_in_child( + "secrets::tests::linux_promotion::missing_secret_service_value_is_promoted_once", + ) { + return; + } + let (store, cache, persistent) = fixture(OPENROUTER_API_KEY); + cache.set_password("synthetic-cache-value").unwrap(); // gitleaks:allow + assert!(matches!( + persistent.get_password(), + Err(keyring::Error::NoEntry) + )); + assert_eq!( + get(OPENROUTER_API_KEY).as_deref(), + Some("synthetic-cache-value") + ); // gitleaks:allow + assert_eq!(cache.get_password().unwrap(), "synthetic-cache-value"); // gitleaks:allow + assert_eq!(persistent.get_password().unwrap(), "synthetic-cache-value"); // gitleaks:allow + assert_eq!(store.lock().unwrap().write_attempts, 1); + assert_eq!( + get(OPENROUTER_API_KEY).as_deref(), + Some("synthetic-cache-value") + ); // gitleaks:allow + assert_eq!(store.lock().unwrap().write_attempts, 1); + } + + #[test] + fn existing_secret_service_value_is_never_overwritten() { + if run_in_child("secrets::tests::linux_promotion::existing_secret_service_value_is_never_overwritten") { + return; + } + let (store, cache, persistent) = fixture(OPENROUTER_API_KEY); + cache.set_password("synthetic-cache-value").unwrap(); // gitleaks:allow + persistent.set_password("synthetic-existing-value").unwrap(); // gitleaks:allow + store.lock().unwrap().write_attempts = 0; + assert_eq!( + get(OPENROUTER_API_KEY).as_deref(), + Some("synthetic-cache-value") + ); // gitleaks:allow + assert_eq!(cache.get_password().unwrap(), "synthetic-cache-value"); // gitleaks:allow + assert_eq!( + persistent.get_password().unwrap(), + "synthetic-existing-value" + ); // gitleaks:allow + assert_eq!(store.lock().unwrap().write_attempts, 0); + } + + #[test] + fn failed_promotion_keeps_email_readable_and_retries() { + if run_in_child("secrets::tests::linux_promotion::failed_promotion_keeps_email_readable_and_retries") { + return; + } + let (store, cache, persistent) = fixture(RESEND_API_KEY); + cache.set_password("synthetic-email-value").unwrap(); // gitleaks:allow + store.lock().unwrap().fail_persistent_read = true; + assert_eq!( + get_resend_api_key(), + Ok(Some("synthetic-email-value".into())) + ); // gitleaks:allow + assert_eq!(cache.get_password().unwrap(), "synthetic-email-value"); // gitleaks:allow + assert!(matches!( + persistent.get_password(), + Err(keyring::Error::Invalid(_, _)) + )); + assert_eq!(store.lock().unwrap().write_attempts, 0); + store.lock().unwrap().fail_persistent_read = false; + store.lock().unwrap().fail_persistent_write = true; + for attempts in 1..=2 { + assert_eq!( + get_resend_api_key(), + Ok(Some("synthetic-email-value".into())) + ); // gitleaks:allow + assert_eq!(cache.get_password().unwrap(), "synthetic-email-value"); // gitleaks:allow + assert!(matches!( + persistent.get_password(), + Err(keyring::Error::NoEntry) + )); + assert_eq!(store.lock().unwrap().write_attempts, attempts); + } + store.lock().unwrap().fail_persistent_write = false; + assert_eq!( + get_resend_api_key(), + Ok(Some("synthetic-email-value".into())) + ); // gitleaks:allow + assert_eq!(cache.get_password().unwrap(), "synthetic-email-value"); // gitleaks:allow + assert_eq!(persistent.get_password().unwrap(), "synthetic-email-value"); // gitleaks:allow + assert_eq!(store.lock().unwrap().write_attempts, 3); + assert_eq!( + get_resend_api_key(), + Ok(Some("synthetic-email-value".into())) + ); // gitleaks:allow + assert_eq!(store.lock().unwrap().write_attempts, 3); + } + + #[test] + fn checked_keys_do_not_query_secret_service_on_later_reads() { + if run_in_child("secrets::tests::linux_promotion::checked_keys_do_not_query_secret_service_on_later_reads") { + return; + } + let (store, cache, persistent) = fixture(OPENROUTER_API_KEY); + cache.set_password("synthetic-cache-value").unwrap(); // gitleaks:allow + assert_eq!( + get(OPENROUTER_API_KEY).as_deref(), + Some("synthetic-cache-value") + ); // gitleaks:allow + assert_eq!(store.lock().unwrap().read_attempts, 1); + assert_eq!( + get(OPENROUTER_API_KEY).as_deref(), + Some("synthetic-cache-value") + ); // gitleaks:allow + assert_eq!(store.lock().unwrap().read_attempts, 1); + assert_eq!(persistent.get_password().unwrap(), "synthetic-cache-value"); // gitleaks:allow + + let (store, _, persistent) = fixture(MINIMAX_API_KEY); + assert_eq!(set(MINIMAX_API_KEY, "synthetic-new-value"), Ok(())); // gitleaks:allow + assert_eq!(store.lock().unwrap().read_attempts, 0); + assert_eq!(get(MINIMAX_API_KEY).as_deref(), Some("synthetic-new-value")); // gitleaks:allow + assert_eq!(store.lock().unwrap().read_attempts, 0); + assert_eq!(persistent.get_password().unwrap(), "synthetic-new-value"); + // gitleaks:allow + } + + fn assert_race(key: &'static str, delete: bool, point: PausePoint) { + use std::sync::mpsc; + use std::time::Duration; + + let (store, cache, persistent) = fixture(key); + cache.set_password("synthetic-v1").unwrap(); // gitleaks:allow + let (reached_tx, reached_rx) = mpsc::channel(); + let (resume_tx, resume_rx) = mpsc::channel(); + store.lock().unwrap().pause = Some(Pause { + point, + reached: reached_tx, + resume: resume_rx, + }); + let reader = std::thread::spawn(move || get(key)); + reached_rx + .recv_timeout(Duration::from_secs(5)) + .expect("lectura pausada"); + let (started_tx, started_rx) = mpsc::channel(); + let (finished_tx, finished_rx) = mpsc::channel(); + let writer = std::thread::spawn(move || { + started_tx.send(()).unwrap(); + let result = set(key, if delete { "" } else { "synthetic-v2" }); // gitleaks:allow + finished_tx.send(result).unwrap(); + }); + started_rx + .recv_timeout(Duration::from_secs(5)) + .expect("escritura iniciada"); + // Without serialization the writer completes while the reader is + // paused. With it the writer waits until the read is released. + let early = finished_rx.recv_timeout(Duration::from_millis(300)); + let finished_before_resume = early.is_ok(); + resume_tx.send(()).unwrap(); + assert_eq!(reader.join().unwrap().as_deref(), Some("synthetic-v1")); // gitleaks:allow + let result = match early { + Ok(result) => result, + Err(mpsc::RecvTimeoutError::Timeout) => finished_rx + .recv_timeout(Duration::from_secs(5)) + .expect("escritura terminada"), + Err(err) => panic!("canal de escritura: {err}"), + }; + assert_eq!(result, Ok(())); + writer.join().unwrap(); + assert!( + !finished_before_resume, + "la escritura debe esperar a la lectura" + ); + if delete { + assert!(matches!(cache.get_password(), Err(keyring::Error::NoEntry))); + assert!(matches!( + persistent.get_password(), + Err(keyring::Error::NoEntry) + )); + // Simulate keyutils briefly returning an invalidated value. + cache.set_password("synthetic-v1").unwrap(); // gitleaks:allow + let reads = store.lock().unwrap().read_attempts; + assert_eq!(get(key).as_deref(), Some("synthetic-v1")); // gitleaks:allow + assert_eq!(store.lock().unwrap().read_attempts, reads); + assert!(matches!( + persistent.get_password(), + Err(keyring::Error::NoEntry) + )); + } else { + assert_eq!(cache.get_password().unwrap(), "synthetic-v2"); // gitleaks:allow + assert_eq!(persistent.get_password().unwrap(), "synthetic-v2"); // gitleaks:allow + } + } + + #[test] + fn racing_set_never_promotes_stale_values() { + if run_in_child( + "secrets::tests::linux_promotion::racing_set_never_promotes_stale_values", + ) { + return; + } + assert_race(OPENROUTER_API_KEY, false, PausePoint::PersistentRead); + assert_race(NAN_API_KEY, false, PausePoint::CombinedRead); + } + + #[test] + fn racing_delete_never_resurrects_a_value() { + if run_in_child( + "secrets::tests::linux_promotion::racing_delete_never_resurrects_a_value", + ) { + return; + } + assert_race(MINIMAX_API_KEY, true, PausePoint::PersistentRead); + assert_race(RESEND_API_KEY, true, PausePoint::CombinedRead); + } + + #[test] + fn existing_set_and_delete_are_delegated_to_the_combined_store() { + if run_in_child("secrets::tests::linux_promotion::existing_set_and_delete_are_delegated_to_the_combined_store") { + return; + } + let (store, cache, persistent) = fixture(OPENROUTER_API_KEY); + assert_eq!(set(OPENROUTER_API_KEY, " synthetic-value "), Ok(())); // gitleaks:allow + assert_eq!(cache.get_password().unwrap(), "synthetic-value"); // gitleaks:allow + assert_eq!(persistent.get_password().unwrap(), "synthetic-value"); // gitleaks:allow + assert_eq!(store.lock().unwrap().write_attempts, 0); + assert_eq!(set(OPENROUTER_API_KEY, ""), Ok(())); + assert!(matches!(cache.get_password(), Err(keyring::Error::NoEntry))); + assert!(matches!( + persistent.get_password(), + Err(keyring::Error::NoEntry) + )); + assert_eq!(store.lock().unwrap().write_attempts, 0); + } + } + #[test] fn scoped_keys_are_validated() { assert!(is_known(OPENROUTER_API_KEY)); @@ -511,8 +1130,9 @@ mod tests { } /// Smoke manual de Secret Service real: verifica que el backend - /// `linux-native` del crate `keyring` persiste y recupera el valor a - /// través de Secret Service. Marcado `#[ignore]` para que no forme parte + /// `linux-native-sync-persistent` del crate `keyring` guarda y recupera + /// el valor. La prueba separada `linux_secret_service_persistent_store` + /// comprueba Secret Service directamente, sin pasar por la caché. Marcado `#[ignore]` para que no forme parte /// del `cargo test` de CI. NO se ejecuta a mano en un escritorio: corre /// en el entorno AISLADO del CI (`dbus-run-session` + `gnome-keyring` /// efímero, paso "Secret Service smoke" de linux-ci.yml), que es la única @@ -565,6 +1185,150 @@ mod tests { assert!(get(&key).is_none(), "la clave debería quedar eliminada"); } + /// Comprueba el almacén persistente directamente y la compatibilidad con + /// entradas creadas por el backend keyutils anterior, sin usar la caché + /// para acreditar la persistencia. + #[cfg(target_os = "linux")] + #[test] + #[ignore = "requiere llavero aislado del CI"] + fn linux_secret_service_persistent_store() { + assert_smoke_isolation(); + struct CleanupGuard(String); + impl Drop for CleanupGuard { + fn drop(&mut self) { + let _ = set(&self.0, ""); + } + } + + let key = scoped( + OPENROUTER_API_KEY, + &format!( + "openrouter:persistent-smoke-{}-{}", + std::process::id(), + std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .unwrap_or_default() + .subsec_nanos() + ), + ); + assert!(crate::config::is_account_id(key.split_once('@').unwrap().1)); + let service = crate::channel::current().identifier; + let native = keyring::Entry::new_with_credential(Box::new( + keyring::keyutils::KeyutilsCredential::new_with_target(None, service, &key) + .expect("entry keyutils anterior"), + )); + let persistent = keyring::Entry::new_with_credential(Box::new( + keyring::secret_service::SsCredential::new_with_target(None, service, &key) + .expect("entry directa de Secret Service"), + )); + assert!(matches!( + native.get_password(), + Err(keyring::Error::NoEntry) + )); + assert!(matches!( + persistent.get_password(), + Err(keyring::Error::NoEntry) + )); + let _guard = CleanupGuard(key.clone()); + + native + .set_password("valor-anterior-en-keyutils") + .expect("crear entrada con el backend anterior"); // gitleaks:allow + assert!(matches!( + persistent.get_password(), + Err(keyring::Error::NoEntry) + )); + assert_eq!(get(&key).as_deref(), Some("valor-anterior-en-keyutils")); // gitleaks:allow + assert_eq!( + persistent.get_password().expect("promoción persistente"), + "valor-anterior-en-keyutils" + ); // gitleaks:allow + assert_eq!( + native.get_password().expect("caché tras promoción"), + "valor-anterior-en-keyutils" + ); // gitleaks:allow + + set(&key, "valor-persistente-de-prueba").expect("set persistente"); // gitleaks:allow + assert_eq!( + persistent.get_password().expect("lectura persistente"), + "valor-persistente-de-prueba" + ); // gitleaks:allow + set(&key, "").expect("borrado persistente"); + assert!(matches!( + persistent.get_password(), + Err(keyring::Error::NoEntry) + )); + } + + /// El fallo de Secret Service no debe aceptar el cambio ni dejar la + /// caché alterada. El bus inexistente se limita a un proceso hijo. + #[cfg(target_os = "linux")] + #[test] + #[ignore = "requiere llavero aislado del CI"] + fn linux_secret_service_unavailable_is_error() { + assert_smoke_isolation(); + const CHILD: &str = "QUORB_SECRETS_SMOKE_NO_SERVICE_CHILD"; + if std::env::var_os(CHILD).is_none() { + let result = std::process::Command::new(std::env::current_exe().unwrap()) + .args([ + "--exact", + "secrets::tests::linux_secret_service_unavailable_is_error", + "--ignored", + "--nocapture", + ]) + .env(CHILD, "1") + .output() + .expect("iniciar proceso aislado"); + assert!( + result.status.success(), + "stdout: {}\nstderr: {}", + String::from_utf8_lossy(&result.stdout), + String::from_utf8_lossy(&result.stderr) + ); + return; + } + + let key = scoped( + OPENROUTER_API_KEY, + &format!("openrouter:offline-smoke-{}", std::process::id()), + ); + let native = keyring::Entry::new_with_credential(Box::new( + keyring::keyutils::KeyutilsCredential::new_with_target( + None, + crate::channel::current().identifier, + &key, + ) + .expect("entry keyutils"), + )); + assert!(matches!( + native.get_password(), + Err(keyring::Error::NoEntry) + )); + struct CleanupGuard(keyring::Entry); + impl Drop for CleanupGuard { + fn drop(&mut self) { + let _ = self.0.delete_credential(); + } + } + let guard = CleanupGuard(native); + guard + .0 + .set_password("valor-anterior-en-cache") + .expect("crear valor anterior"); // gitleaks:allow + let tmp = std::env::var("QUORB_SECRETS_SMOKE_TMPHOME").unwrap(); + std::env::set_var( + "DBUS_SESSION_BUS_ADDRESS", + format!("unix:path={tmp}/no-secret-service-bus"), + ); + let err = set(&key, "valor-rechazado").expect_err("Secret Service ausente debe fallar"); // gitleaks:allow + assert!(!err.is_empty()); + assert!(!err.contains("valor-rechazado")); + assert_eq!( + guard.0.get_password().expect("lectura de caché"), + "valor-anterior-en-cache" + ); // gitleaks:allow + } + /// Smoke manual de MIGRACIÓN del servicio legado, también `#[ignore]`: /// pobla el espacio legado (`LEGACY_SERVICE` = `es.egdev.ai-usage`) con /// una clave, y verifica que `get()` la recupera POR LA VÍA DE MIGRACIÓN From cdaac149ae3ad812460738c891bfbb31033fff4d Mon Sep 17 00:00:00 2001 From: egdev6 Date: Fri, 20 Nov 2026 17:16:25 +0100 Subject: [PATCH 3/5] docs(linux): describe the persistent Secret Service credential store (#302) --- README.es.md | 4 +-- README.md | 4 +-- docs/build-linux.md | 32 ++++++++++++++-------- odd/tasks/302-linux-keyring-persistence.md | 32 ++++++++++++++++++++++ 4 files changed, 56 insertions(+), 16 deletions(-) create mode 100644 odd/tasks/302-linux-keyring-persistence.md diff --git a/README.es.md b/README.es.md index e81d6d05..15171d1f 100644 --- a/README.es.md +++ b/README.es.md @@ -185,7 +185,7 @@ Ilustraciones promocionales, no capturas directas. ### Privacidad y datos locales -Las API keys y la sesión de NaN se guardan en el almacén seguro del sistema (Windows Credential Manager; en Linux, Secret Service; en macOS, Keychain). Los archivos de sesión de las herramientas oficiales se leen sin escribir en ellos ni rotar refresh tokens. Gemini renueva su token de acceso de corta duración en memoria. Si caduca el login de una CLI, iniciad sesión de nuevo con la herramienta oficial. +Las API keys y la sesión de NaN se guardan en el almacén seguro del sistema (Windows Credential Manager; en Linux, un almacén persistente Secret Service con keyutils del kernel como caché; en macOS, Keychain). Linux requiere un Secret Service en ejecución, como GNOME Keyring o KWallet. Las credenciales que versiones anteriores guardaron solo en keyutils se copian a Secret Service la primera vez que Quorb las lee, siempre que sea antes de un reinicio. Los archivos de sesión de las herramientas oficiales se leen sin escribir en ellos ni rotar refresh tokens. Gemini renueva su token de acceso de corta duración en memoria. Si caduca el login de una CLI, iniciad sesión de nuevo con la herramienta oficial. La configuración y el historial se guardan en la carpeta de usuario de cada plataforma (`%APPDATA%\es.egdev.quorb` en Windows, `~/.config/es.egdev.quorb` en Linux). Quorb consulta directamente los endpoints de los proveedores; no requiere un backend separado. El historial cubre hasta 30 días. @@ -199,7 +199,7 @@ La firma Authenticode de Windows y distribución por winget, el modo click-throu Está en marcha un port nativo de Linux (issues ODD #105–#108 del proyecto `quorb-linux-local-v1`). Lo que funciona hoy es desarrollo y pruebas locales, no una release distribuida: -- Requisitos: Node 22+, Rust y las librerías de sistema habituales de Tauri (`libwebkit2gtk-4.1-dev`, `build-essential`, `curl`, `wget`, `file`, `libxdo-dev`, `libssl-dev`, `libayatana-appindicator3-dev`, `librsvg2-dev`). Para ejecutar desde fuente, `npm install` + `npm run app:dev`. +- Requisitos: Node 22+, Rust y las librerías de sistema habituales de Tauri (`libwebkit2gtk-4.1-dev`, `libdbus-1-dev`, `pkg-config`, `build-essential`, `curl`, `wget`, `file`, `libxdo-dev`, `libssl-dev`, `libayatana-appindicator3-dev`, `librsvg2-dev`). Para ejecutar desde fuente, `npm install` + `npm run app:dev`. - Los formatos de bundle local instalable ya están decididos: `.deb` para Debian/Ubuntu y `.AppImage` para Arch y el resto (ver [`docs/build-linux.md`](./docs/build-linux.md)). Se construyen y verifican con el workflow manual de Linux (`.github/workflows/linux-ci.yml`, `with_bundle: bundle`) o localmente con `npm run app:build` + los scripts `.testcontainer/verify-*.sh`. Los artefactos del CI quedan privados a cada run; las releases públicas de Linux quedan fuera de alcance por ahora. - Las limitaciones de sesión y comportamiento dependen del escritorio, y Ajustes las muestra por superficie en el bloque «Sesión de escritorio»: - X11: comportamiento completo de siempre-encima, icono de bandeja, atajos globales y transparencia (esta última solo con un compositor). diff --git a/README.md b/README.md index 6199e3e8..ef11d345 100644 --- a/README.md +++ b/README.md @@ -183,7 +183,7 @@ Promotional illustrations, not raw screenshots. ### Privacy and local data -API keys and the NaN session are stored in the system's secure store (Windows Credential Manager; on Linux, Secret Service; on macOS, Keychain). Official CLI/app session files are read without writing to them or rotating refresh tokens. Gemini refreshes its short-lived access token in memory. If a CLI login expires, sign in again through the official tool. +API keys and the NaN session are stored in the system's secure store (Windows Credential Manager; on Linux, a persistent Secret Service store with kernel keyutils as a cache; on macOS, Keychain). Linux requires a running Secret Service such as GNOME Keyring or KWallet. Credentials saved by earlier versions only in keyutils are copied into Secret Service the first time Quorb reads them, as long as that happens before a reboot. Official CLI/app session files are read without writing to them or rotating refresh tokens. Gemini refreshes its short-lived access token in memory. If a CLI login expires, sign in again through the official tool. Configuration and history are stored under the platform user directory (`%APPDATA%\es.egdev.quorb` on Windows, `~/.config/es.egdev.quorb` on Linux). Quorb calls provider endpoints directly; no separate backend is required. History covers up to 30 days. @@ -197,7 +197,7 @@ Windows Authenticode signing and winget distribution, click-through mode and NaN A native Linux port is under development (tracking issues #105–#108 of the ODD project `quorb-linux-local-v1`). What works today is local development and testing, not a distributed release: -- Requirements: Node 22+, Rust, and the usual Linux system libraries of Tauri (`libwebkit2gtk-4.1-dev`, `build-essential`, `curl`, `wget`, `file`, `libxdo-dev`, `libssl-dev`, `libayatana-appindicator3-dev`, `librsvg2-dev`). Run from source with `npm install` + `npm run app:dev`. +- Requirements: Node 22+, Rust, and the usual Linux system libraries of Tauri (`libwebkit2gtk-4.1-dev`, `libdbus-1-dev`, `pkg-config`, `build-essential`, `curl`, `wget`, `file`, `libxdo-dev`, `libssl-dev`, `libayatana-appindicator3-dev`, `librsvg2-dev`). Run from source with `npm install` + `npm run app:dev`. - Local installable bundles are decided: `.deb` for Debian/Ubuntu and `.AppImage` for Arch and the rest (see [`docs/build-linux.md`](./docs/build-linux.md)). They are built and verified by the manual Linux workflow (`.github/workflows/linux-ci.yml`, `with_bundle: bundle`) or locally with `npm run app:build` + the `.testcontainer/verify-*.sh` scripts. CI artifacts stay private to each run; public Linux releases are out of scope for now. - Session and behaviour limits depend on the desktop session, and Settings shows them per surface in the «Sesión de escritorio» block: - X11: complete behaviour of always-on-top, tray icon, global shortcuts and transparency (the last only with a compositing WM). diff --git a/docs/build-linux.md b/docs/build-linux.md index 5788c633..18847add 100644 --- a/docs/build-linux.md +++ b/docs/build-linux.md @@ -5,6 +5,13 @@ > Wayland) y el contrato de soporte inicial **antes** de L1/L2/L3. > **Cero código en esta unidad**: solo mediciones, decisiones y docs. > Compilación ≠ experiencia funcional. +> +> **Backend actual de secretos (#302):** Secret Service es el almacén +> persistente y keyutils del kernel actúa como caché. Se necesita un Secret +> Service en ejecución, por ejemplo GNOME Keyring o KWallet. Las credenciales +> anteriores que solo estén en keyutils se copian a Secret Service la primera +> vez que Quorb las lee, siempre que sea antes de un reinicio. Las mediciones +> del baseline de 0.8.0 citadas abajo son históricas. ## 1. Resumen ejecutivo @@ -57,8 +64,9 @@ node 24.15, npm 12.0.1, rustc/cargo 1.99, TypeScript 5.9, Vite 7, vitest 4.1.11. tauri 2 (`tray-icon`, `protocol-asset`) + 9 plugins (opener, autostart, single-instance, notification, dialog, global-shortcut, updater, process); -reqwest (`rustls-tls`, sin openssl), rusqlite `bundled`, keyring con feature -`linux-native`, serde/serde_json, chrono, dirs, base64, futures, libc (unix). +reqwest (`rustls-tls`, sin openssl), rusqlite `bundled`, keyring con features +`linux-native-sync-persistent` y `crypto-rust`, serde/serde_json, chrono, dirs, +base64, futures, libc (unix). El backend usa libdbus del sistema, sin `vendored`. ### 3.3 Dependencias de sistema (runtime, las que declara el `.deb`) @@ -86,6 +94,7 @@ Del `setup.sh` / workflow `apt-get install` (versiones medidas en devcontainer | libayatana-appindicator3-dev | 0.5.90-7ubuntu2 | | libxdo-dev | 1:3.20160805.1-4 | | libgtk-3-dev, libsecret-1-dev, librsvg2-dev, libnotify-dev, libssl-dev, build-essential, pkg-config | instalados vía `setup.sh` (no listados en la sesión) | +| libdbus-1-dev | requerido desde #302; no medido en el baseline histórico | **Nota**: el host (26.04) **no tiene las dev libs** (`webkit2gtk-4.1`, `gtk+-3.0`, `libsecret-1`, `ayatana-appindicator3-0.1`, `librsvg-2.0`, @@ -172,11 +181,10 @@ Dos niveles de evidencia, separados explícitamente: arranque directo del AppImage en este escritorio real con `AppImageLauncher` presente, con workaround probado (unsquashfs + AppRun) y el `.deb` como vía recomendada en Debian/Ubuntu. -4. **Backend de secretos** — `keyring` usa la feature `linux-native`, cuyo - backend real es `linux-keyutils`/keyutils del kernel. La prueba end-to-end - de esta unidad debe medir ese backend (y, si el criterio se mantiene como - «Secret Service», registrar explícitamente que no es el backend configurado), - sin exponer credenciales. #106 ya está cerrada; no queda como placeholder. +4. **Backend de secretos del baseline 0.8.0** — entonces `keyring` usaba + `linux-native`, solo keyutils del kernel. Desde #302 se configura el backend + combinado: Secret Service persiste y keyutils sirve de caché. Las mediciones + históricas de #106 no prueban el backend persistente actual. 5. **Hallazgos de contribuidores** (del comentario de Rafael en #105): `connect_map` GTK crash y `startDragging()` nativo vs layer-shell pertenecen al ajuste de escritorio de #107/#290, no al empaquetado de #108. @@ -222,7 +230,7 @@ timeout -k 5 30 /usr/bin/quorb > launch.log 2>&1; echo $? # -> 124 # gdk_wayland_window_set_dbus_properties_libgtk_only, libayatana-appindicator # is deprecated, gtk_widget_get_scale_factor. -# 4) Backend de secretos real (keyutils del kernel, no Secret Service) +# 4) Backend de secretos del baseline 0.8.0 (keyutils, antes de #302) keyctl show # Session Keyring con los keyrings de sesión, usuario y persistente (keyutils) @@ -396,7 +404,7 @@ sesión Wayland, Quorb por XWayland (`GDK_BACKEND=x11`), tres escritorios. | AppImage: cadena FUSE + librerías gráficas de runtime | Media: monta en CI (kernel 6.8 y 7.0, runs del fork) pero falla en el escritorio real del host (§4.3 fallo 3) | Bajo (el `.deb` no lo sufre) | Requiere `/dev/fuse` (cargar el módulo con `sudo modprobe fuse` solo si no está cargado, §10) y, en los runs del fork, `libegl1/libgl1/libgles2` + `libfuse2`/`libfuse2t64`; workaround `--appimage-extract-and-run` | Runs de §4.3: montaje FUSE + vivo 60 s en CI | | WebKit2GTK ≥ 2.40 / GTK ≥ 3.22 (distros antiguas) | Media | Alto (excluye usuarios) | Documentar versión mínima; diferir distros no-Debian/Arch | PRD línea 110; `linux-ci.yml` apt | | libayatana deprecation warning en runtime | Alta (cosmético) | Bajo | Nada (no impide) | Log de arranque del `.deb` (host) | -| `keyring` linux-native requiere keyutils disponible (keyring del kernel); entorno sin keyutils | Media | Medio | Fallo explícito del command, no degradar a texto plano; #106 ya cerrada y el backend real queda documentado aquí | `src-tauri/src/secrets.rs` (`keyring::Entry::new`) | +| `keyring` requiere keyutils y un Secret Service en ejecución (GNOME Keyring o KWallet) | Media | Medio | Fallo explícito al guardar si no hay Secret Service, sin fallback a texto plano; keyutils es solo la caché | `src-tauri/src/secrets.rs` (`keyring::Entry::new`) | | `connect_map` GTK crash (Rafael) | Desconocida | Medio | Ajuste de escritorio #107/#290, fuera del empaquetado | Comentario de Rafael en #105 | | `startDragging()` nativo vs layer-shell (Rafael) | Desconocida | Medio | Ajuste de escritorio #107/#290, fuera del empaquetado | Comentario de Rafael en #105 | | ~~No hay gate de CI Linux para PRs~~ (resuelto en #150; infra de bundles en #127/#108) | — | — | `linux-pr-ci.yml` (tests+build por PR, desde #150) y `linux-ci.yml` (manual, `with_bundle`, desde #127/#108) | `linux-ci.yml`/`linux-pr-ci.yml` en `main` | @@ -422,7 +430,7 @@ sesión Wayland, Quorb por XWayland (`GDK_BACKEND=x11`), tres escritorios. | Nivel | Issue | Alcance | Validación | |---|---|---|---| -| L1 | #106 — sesiones, secretos y login CLI nativos (**cerrada**) | Rutas Linux, backend real `keyring`/keyutils, login CLI y recuperación documentados | Validación de #106; límites de escritorio real explícitos en §6 | +| L1 | #106 — sesiones, secretos y login CLI nativos (**cerrada**) | Rutas Linux, backend de entonces `keyring`/keyutils, login CLI y recuperación documentados | Validación histórica de #106; backend actual combinado desde #302 | | L2 | #107 — escritorio y widget nativos (**integrada; ajuste diagnóstico en #290**) | Bloque de compatibilidad y fixes de escritorio; tao#1204 integrado en `main` | Smoke de CI + ajustes pendientes de #290 | | L3 | #108 — empaquetar y documentar un build local verificable (**esta PR**) | `.deb` + `.AppImage` reproducibles, docs actualizados y gate Linux ya disponible | `linux-ci.yml` + `linux-pr-ci.yml` + evidencia de AppImage en §4.3 | @@ -435,7 +443,7 @@ en este baseline). # --- Build-time deps (solo para contribuir / hacer cargo test) --- # Host Ubuntu 22.04/26.04: sudo apt-get install -y build-essential pkg-config libwebkit2gtk-4.1-dev \ - libxdo-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev \ + libdbus-1-dev libxdo-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev \ libsecret-1-dev libnotify-dev libgtk-3-dev # (o usar el devcontainer: `devcontainer up` según el Makefile — evita # tocar el host; no requiere instalar nada en la máquina real) @@ -463,7 +471,7 @@ sudo apt install linux-modules-extra-$(uname -r) |---|---|---| | `src-tauri/tauri.conf.json` | Windows-first con Linux: `nsis`/`msi` + `deb`/`appimage` | Confirmado desde #108: `bundle.targets` de `main` incluye los cuatro | | `src-tauri/src/lib.rs` `run()` | Arranque sin crash, single-instance, shortcuts, tray | Arranca en host: `.deb` 0.8.0 y AppImage 0.8.0 extraído, ambos exit 124 = vivo 30 s (evidencia de la versión actual en §4.4 de esta PR); panic tao#1204 resuelto e integrado (via #107) | -| `src-tauri/src/secrets.rs` | `keyring::Entry::new` con `linux-native` (keyutils, `linux-keyutils`) | Backend real: keyutils; persistencia y fallo sin keyutils validados en #106 (cerrada) | +| `src-tauri/src/secrets.rs` | `keyring::Entry::new` con `linux-native-sync-persistent` | Secret Service persistente con caché keyutils; el baseline #106 medía el backend anterior solo keyutils | | `src-tauri/src/login.rs` | Login CLI con terminal Linux | Cascade `$TERMINAL → ghostty → kitty → alacritty`, validado en #106 (cerrada) | | `src-tauri/src/providers/` (11 módulos: anthropic_api, claude, codex, copilot, cursor, gemini, nan, nan_cloud, openai_api, openrouter) | Puro HTTP (reqwest) | Sin dependencia específica de plataforma; portables | | `src/lib/dock.ts` | Geometría de bordes (píxeles lógicos) | Sin dependencia de plataforma; portables | diff --git a/odd/tasks/302-linux-keyring-persistence.md b/odd/tasks/302-linux-keyring-persistence.md new file mode 100644 index 00000000..bfcc35b5 --- /dev/null +++ b/odd/tasks/302-linux-keyring-persistence.md @@ -0,0 +1,32 @@ +# Linux credential persistence (#302) + +Linux credentials are stored with `keyring` `linux-native` (kernel keyutils), which is in-memory and lost on reboot. Switch to keyutils + Secret Service persistence for 0.9.1. +Owner: @egdev6. Branch: `fix/302-linux-keyring-persistence`. Risk: items 2 (credential storage) and 5 (dependencies / CI). + +## Specs + +- S1. Problem (issue #302, keyring docs quoted): `linux-native` = «access to the `keyutils` storage on Linux»; keyutils «is completely in-memory and will not persist across reboots». README promises «on Linux, Secret Service». +- S2. Fix: in `src-tauri/Cargo.toml`, replace `linux-native` with `linux-native-sync-persistent` («Uses both `keyutils` and `sync-secret-service` for storage»), keeping `windows-native` and `apple-native` unchanged. Windows and macOS behavior and their `Cargo.lock` resolution must not change beyond what the feature switch requires. Choose the crypto/vendoring sub-features the crate requires for `sync-secret-service`, preferring system `libdbus` (no vendored C code) unless the crate docs require otherwise; justify the choice. +- S3. Existing keys stored in keyutils must still be readable after updating (until the next reboot), and nothing may be written in plain text or degrade silently: a missing Secret Service must surface as an explicit error, as today. +- S3b. Promotion: when a read finds a value only in keyutils (absent from Secret Service), Quorb copies it into Secret Service once, so users who update and then reboot without re-saving keep their keys. A failed promotion must not lose or change the keyutils value nor fail the read; it is retried on a later read. No value is ever logged. Promotion must never overwrite or resurrect a value saved or deleted concurrently through `set` (process-wide serialization of promotion and `set`; Quorb is single-instance), and Secret Service is checked at most once per key per process after a successful check or promotion, so plain reads do not trigger repeated Secret Service lookups or unlock prompts. +- S4. Tests: a Linux-only `#[ignore]` smoke, run in the isolated CI Secret Service environment (same `assert_smoke_isolation()` gate as `linux_secret_service_round_trip`), proving that after `set` the value is stored in Secret Service itself (read back through the crate's Secret Service store directly, not through the keyutils cache), plus deletion. Wire it into the existing "Secret Service smoke" step of `linux-ci.yml`. Existing tests keep passing (`cargo test --locked`, `npm test`). +- S5. Build dependencies: add what the new backend needs to compile (e.g. `libdbus-1-dev`, `pkg-config`) wherever Linux builds run: `.github/workflows/linux-ci.yml`, `.github/workflows/linux-pr-ci.yml`, `.github/workflows/linux-release.yml`, and the devcontainer/Makefile/docs dependency lists that enumerate Linux build packages. Keep actions pinned and inputs untouched. +- S6. Docs: correct the Linux secret-store wording in `README.md`, `README.es.md` and `docs/build-linux.md` (Secret Service persistent store with kernel keyutils as cache; requires a running Secret Service such as GNOME Keyring or KWallet). + +## Tasks + +| ID | Specs | Route | Commit | +| --- | --- | --- | --- | +| T1 | S2–S6, S3b | gentle-ai-worker | — | +| T2 | S1–S6 | gentle-ai-verify (Risk: items 2, 5) | — | +| T3 | — | parent: CI run of linux-ci with Secret Service smoke, PR | — | + +## Log + +- L1 (owner, after the evidence in #302 was presented: «¿Abro la issue del bug y arranco el arreglo para la 0.9.1?»): «si» +- L2 (parent): evidence — `src-tauri/Cargo.toml:39` `keyring = { version = "3", features = ["windows-native", "apple-native", "linux-native"] }`; `secrets.rs` uses `keyring::Entry::new` with no custom builder; the CI smoke is a same-process round trip and passes with keyutils. No workflow installs `libdbus-1-dev`. +- L3 (worker T1): keyring 3.6.3's default persistent builder only builds `SsCredential`; Quorb builds the combined credential explicitly. Existing keyutils-only values are readable until reboot but not promoted. `zbus`/`secret-service` appear in Cargo.lock but `cargo tree --target all` compiles neither (only `dbus-secret-service` 4.1.0). Parent checks: `npm test` exit 0 (vitest 1241, node 329), `cargo test --locked` 734 passed, `cargo fmt` ok. +- L5 (verify T2): S1–S6 and S3b pass, no blockers; Windows/macOS dependency trees identical to baseline; no vendored C. Advisories: promotion check-then-write race with concurrent `set`/delete (stale value or resurrected deleted key); every `get` now queries Secret Service (possible unlock prompt). Real Secret Service smokes need linux-ci. +- L6 (parent): S3b extended with serialization and once-per-key check to resolve both advisories. +- L4 (parent): added S3b (promotion on read) — without it, users who update to 0.9.1 and reboot before re-saving still lose their keys. +- L7 (re-verify T2): S3 and S3b met, no blockers. `cargo test --locked` 741 passed; race tests 20/20; 16-thread probe finished (no deadlock); poisoning recovered. Minor, follow-up: a dismissed unlock prompt is retried on every refresh; absent keys still search Secret Service each read; UI can wait on an open unlock prompt (lock held across the D-Bus call); legacy-service migration keeps its pre-existing check-then-write. From b2a2d13ef65104a4408430bdc4ab22fede20ac65 Mon Sep 17 00:00:00 2001 From: egdev6 Date: Fri, 20 Nov 2026 17:16:33 +0100 Subject: [PATCH 4/5] docs(odd): record #302 slices and verification --- odd/tasks/302-linux-keyring-persistence.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/odd/tasks/302-linux-keyring-persistence.md b/odd/tasks/302-linux-keyring-persistence.md index bfcc35b5..830a6745 100644 --- a/odd/tasks/302-linux-keyring-persistence.md +++ b/odd/tasks/302-linux-keyring-persistence.md @@ -17,8 +17,8 @@ Owner: @egdev6. Branch: `fix/302-linux-keyring-persistence`. Risk: items 2 (cred | ID | Specs | Route | Commit | | --- | --- | --- | --- | -| T1 | S2–S6, S3b | gentle-ai-worker | — | -| T2 | S1–S6 | gentle-ai-verify (Risk: items 2, 5) | — | +| T1 | S2–S6, S3b | gentle-ai-worker | 986517e (ci deps), 14fa47f (fix + tests), cdaac14 (docs) | +| T2 | S1–S6 | gentle-ai-verify (Risk: items 2, 5) | verified twice (L5, L7) | | T3 | — | parent: CI run of linux-ci with Secret Service smoke, PR | — | ## Log From 706519efa1b7b5325426d66c6a2ac6e0a45d6883 Mon Sep 17 00:00:00 2001 From: egdev6 Date: Fri, 20 Nov 2026 17:49:58 +0100 Subject: [PATCH 5/5] chore(i18n): refresh inventory tree hashes (#302) --- docs/i18n-inventory.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/i18n-inventory.md b/docs/i18n-inventory.md index 9bfe46c3..8229fddc 100644 --- a/docs/i18n-inventory.md +++ b/docs/i18n-inventory.md @@ -1,6 +1,6 @@ # i18n inventory (egdev6/quorb#66) -Generated by `node scripts/i18n-inventory.mjs` from the source trees `src/` = `5d1f8cd9a87b8308b2397ee124ddf7895400568b` and `src-tauri/src/` = `404315f914c8a61c84a0c3bf550df11b56d33a81`. +Generated by `node scripts/i18n-inventory.mjs` from the source trees `src/` = `5d1f8cd9a87b8308b2397ee124ddf7895400568b` and `src-tauri/src/` = `4e040c3e38251119abf3e7d0de46376d82d9c885`. Any commit whose `git rev-parse :src` and `:src-tauri/src` match has these exact texts. Do not edit by hand: regenerate, or verify with `node scripts/i18n-inventory.mjs --check`.