Repository navigation
fix(desktop): account deletion finishes its local cleanup, native avatar downloads stay within the app's policy, links through the opener plugin - #302
Merged
Conversation
…deleted Self-service account deletion dropped the local E2E vault but left the key that opens it on the device: in the OS credential store in the desktop app, and in localStorage in the browser build or wherever a keychain write had fallen back to it. The shell gains e2e_pickle_key_delete(user_id), beside the get and set commands: the same user-id check, the service from keychain_services, and a missing entry counts as deleted; the keychain call runs on the blocking pool, off the window's thread. PickleKeyProvider gains remove(userId): the keychain backend removes its localStorage copy and asks the command, the localStorage backend removes its item. forgetLocalE2EState() deletes the vault, then removes its key, and never rejects: a vault or a key it cannot remove is logged and the account deletion still completes (the wait for the vault's delete request is bounded). deleteAccount waits for it; logout never calls it and keeps both. The Cookie Policy (English and French, its "Last updated" date moved to November 18, 2026) and the protocol spec now say the key is deleted with the vault. Closes #121
…app's policy allows The native avatar download (Windows notifications) took the API base the webview passed and checked only that it started with http:// or https://. A native request is not bound by the webview's content security policy, and it also followed redirects. The shell now compares that base with the policy the app was built with, read from its compiled configuration (a policy string or a map of directives): it is accepted only when its origin (scheme, host, port, a default port written out or not) is an http(s) origin that the policy's connect-src names exactly. A wildcard source, a keyword, a scheme source, a ws(s) source, a source with a path and Tauri's own IPC host match nothing; a base with credentials, a query or a fragment is refused. A debug build also accepts http on localhost and 127.0.0.1, on any port. A refused base fails the command before any request (the notification falls back to the plugin and the reason is logged once); the apiBase argument stays and is only ever compared. The request URL is built from the checked base and asks the server to proxy the image (?inline); no redirect is followed, and any answer other than a success is a failure. The key, size, image-signature and symlink checks are unchanged. The webview logs each distinct reason a notification tier failed once. Closes #122
…Tauri app services/notifications.ts imported @tauri-apps/plugin-notification and @tauri-apps/api/core statically, the only file under apps/desktop/src that did, so every browser session downloaded and ran desktop-only code. Both modules are now loaded with import() on the Tauri path only, each on first use and kept for later calls (a failed load is tried again next time). The three tiers behave as before: the shell's command, then the notification plugin, then the Web Notification API. Each catch now logs the reason a tier failed, once per distinct reason. A Vite plugin (scripts/browserEntryGuard.mjs, registered in vite.config.ts) fails a production build when a chunk the browser loads at startup, an entry chunk or one it imports statically, holds a @tauri-apps module, naming the package. Tests cover the guard over output bundles, a scan that no file under src outside the tests imports @tauri-apps statically, and notify() and initNotifications() in both builds: a browser session loads no Tauri module. Closes #123
… one app handler External links (target="_blank": message links, the legal documents' web and mail links) opened in the system browser only through the click script that tauri-plugin-shell injects; nothing in the app's source showed it, and the plugin's open API is deprecated in favour of tauri-plugin-opener. tauri-plugin-shell is replaced by tauri-plugin-opener 2.7.3 (Rust crate and @tauri-apps/plugin-opener, both MIT OR Apache-2.0). The plugin is registered with its own injected click script turned off; the single-instance plugin stays the first one registered. The capability grants opener:allow-open-url scoped to http://*, https://* and mailto:* (the system's default application only) and no shell permission. utils/externalLinks.ts installs, in the Tauri app only, one click handler on the document, in the capture phase, so a modal or a portal that stops a click's propagation cannot keep a link from it: a primary-button click on an anchor with target="_blank" whose href attribute, parsed without a base, is an http, https or mailto URL is opened through openUrl (the plugin loaded with import() on the first such click) and its default prevented. A scheme-relative href (//host/path) is opened over https, as a browser on an https page opens it. A failure is logged as one fixed line, nothing of the error (which can carry the address, and a link can be an invite). Every other link, a relative href and tel: included, is left to the webview. The browser build installs nothing. main.tsx installs it before the first render. Cargo.lock gains tauri-plugin-opener and loses tauri-plugin-shell, os_pipe, shared_child, encoding_rs, core_detect and multiversion_no_op; pnpm-lock.yaml gains @tauri-apps/plugin-opener (on the @tauri-apps/api already locked). The generated permission schemas under gen/schemas follow. Closes #126
…he app leaves the page While the server deletes an account it ends the account's sessions: it sends force:logout to every socket of the account, the deleting client's included, before its transaction and again after the commit, and refuses the account's other requests. The force:logout handler and the lost-session path both change the page to the login page, with no link to the deletion in flight: a page change before the answer skipped the whole local cleanup (the vault, its key, the secure-channel pins, the trusted-device token), and one during the cleanup could cut the key removal short. deleteAccount now marks the deletion in flight from before its request goes out (services/accountDeletion.ts, a module without imports) until its local cleanup has finished after a successful answer, the trusted-device clear flushed to the token store included, or until the request failed, which erases nothing. The force:logout handler (after its own logout and token flush, as before) and handleSessionLost (after its flush) wait for it before they navigate, for 90 seconds at most, then log one warning and navigate. Neither erases anything on the word of a force:logout. With no deletion in flight both behave as before. The login page is on screen during that wait. Every action that starts a session (login, the two-factor step, both sign-up steps, a password change's renewed pair, the session restore) waits for a deletion in flight before it sends anything, so the cleanup's logout and trusted-device clear never land on a session started meanwhile. With none in flight they await nothing and keep today's order. Refs #121
…'s thread e2e_pickle_key_get, e2e_pickle_key_set and notify_with_avatar were synchronous commands, which Tauri runs on the main thread: a keychain call (Credential Manager, the Keychain, a D-Bus round trip to the Secret Service) or the avatar download (up to 10 s), its file work and the toast held the thread that paints the window. They are now async, with that work on the blocking pool, as the session commands and e2e_pickle_key_delete already do; a join failure is answered as an error string. Names, arguments, results and error strings are unchanged. notify_with_avatar reads the build's configuration on the calling side and does the base check, the download, the cache and the toast on the blocking pool. The toast keeps no thread of its own: tauri-winrt-notification makes plain WinRT calls with no apartment set up, which windows-core runs in the process's multithreaded apartment on any thread, and Tauri's notification plugin shows its toasts from a runtime task as well. A source test pins every registered command as async, with its blocking work on the blocking pool.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
force:logoutto every socket of the account (the deleting client's included) before its transaction and again after the commit, and refuses the account's other requests. Theforce:logouthandler and the lost-session path change the page to the login page with no link to the deletion in flight: a page change before the answer skipped the whole local cleanup (the vault, its key, the secure-channel pins, the trusted-device token), and one during the cleanup could cut the key removal short.notifications.tsimported Tauri modules statically. It was the only file underapps/desktop/srcthat did, so@tauri-apps/plugin-notificationand@tauri-apps/api/corewere part of what every browser session downloads at startup.target="_blank"reached the system browser becausetauri-plugin-shellinjects a click handler that nothing in the app's source showed. That plugin's open API is deprecated, and the plugin also carries process-execution commands the app never used.What the code does now
e2e_pickle_key_delete(user_id)beside the get and set commands: the same user-id check, the service fromkeychain_services, and a missing entry counts as deleted.PickleKeyProviderhasremove(userId): the keychain backend removes its localStorage copy and asks the command, the localStorage backend removes its item.forgetLocalE2EState()deletes the vault, then removes its key, and never rejects: what it cannot remove is logged and the account deletion still completes (its wait for the vault's delete request is bounded). Logout never calls it and keeps both. The Cookie Policy (English and French, dated November 18, 2026) and the protocol spec say the key is deleted with the vault.deleteAccountmarks the deletion in flight (services/accountDeletion.ts) from before its request goes out until its local cleanup has finished after a successful answer (the vault, its key, the pins, the trusted-device token, that clear flushed to the token store), or until the request failed, which erases nothing: the account may still exist. Theforce:logouthandler (after its own logout and token flush, as before) and the lost-session path (after its flush) wait for it before they navigate, for 90 seconds at most, then log one warning and navigate. Neither erases anything on the word of aforce:logout: the first one comes before the server's transaction. With no deletion in flight both behave as before. Every action that starts a session (a sign-in, the two-factor step, both sign-up steps, a password change's renewed pair, a session restore) waits for a deletion in flight before it sends anything, so the cleanup never signs out or clears a session started from the login page meanwhile. The other ways a page could change during a deletion go through one of these two: a refused request or a refused socket handshake ends in the lost-session path, and another tab's sign-out only updates this tab's memory.connect-srcnames exactly. A wildcard source, a keyword, a scheme source, a ws(s) source, a source with a path and Tauri's own IPC host match nothing; a base with credentials, a query or a fragment is refused. A debug build also accepts http onlocalhostand127.0.0.1, any port. A refused base fails the command before any request, and the notification falls back to the plugin. TheapiBaseargument stays (the webview passes its build-time constant) and is only compared. The request is built from the checked base, asks the server for the proxied image (?inline), follows no redirect, and treats any answer other than a success as a failure; the key, size, image-signature and symlink checks are unchanged.notifications.tsloads both modules withimport()on the Tauri path, on first use, kept for later calls (a failed load is tried again). The three tiers behave as before; each catch now logs why a tier failed, once per distinct reason. A Vite plugin,scripts/browserEntryGuard.mjs, fails a production build when a chunk the browser loads at startup (an entry chunk or one it imports statically) holds a@tauri-appsmodule, and names the package.tauri-plugin-shellis replaced bytauri-plugin-opener2.7.3 (Rust crate and@tauri-apps/plugin-opener, both MIT OR Apache-2.0), registered with its own injected click script turned off; the single-instance plugin stays the first one registered. The capability grantsopener:allow-open-urlscoped tohttp://*,https://*andmailto:*, with the system's default application only, and noshell:permission.utils/externalLinks.tsinstalls, in the Tauri app only, one click handler on the document, in the capture phase (ahead of the app's own handlers, so a modal or a portal that stops a click's propagation cannot keep a link from it): a primary-button click on an anchor withtarget="_blank"whosehrefattribute, parsed without a base, is an http, https or mailto URL is opened throughopenUrland its default prevented. A scheme-relative href (//host/path) is opened over https, as a browser on an https page opens it. A failure is logged as one fixed line that carries nothing of the error. A relative href, any other scheme (tel:included: the app has no such link) and any other target are left to the webview. The browser build installs nothing and opens links in a new tab as before.e2e_pickle_key_get,e2e_pickle_key_set,e2e_pickle_key_deleteandnotify_with_avatarare async, with their blocking work on the blocking pool like the session commands; a join failure is answered as an error string. Their names, arguments, results and error strings are unchanged.notify_with_avatarreads the build's configuration, then checks the base, downloads, caches and shows the toast on the blocking pool: the toast library makes plain WinRT calls with no apartment of its own, which run on any thread, and Tauri's notification plugin shows its toasts from a runtime task as well.For people who build their own app
connect-src.pnpm tauri:buildwrites it so; a policy written by hand must name it exactly, since a wildcard source matches nothing for the native download.Key files
apps/desktop/src-tauri/src/lib.rs(e2e_pickle_key_delete,allowed_avatar_base,connect_src_of,avatar_url,download_avatar,show_avatar_toast, the plugin registration inrun())apps/desktop/src-tauri/Cargo.toml,Cargo.lock,capabilities/default.json,gen/schemas/*apps/desktop/src/services/e2e/pickleKeyProvider.ts,apps/desktop/src/services/e2e/e2eService.ts(forgetLocalE2EState),apps/desktop/src/stores/authStore.ts(deleteAccount)apps/desktop/src/services/accountDeletion.ts,apps/desktop/src/services/socket.ts(force:logout),apps/desktop/src/services/session.ts(handleSessionLost)apps/desktop/src/services/notifications.ts,apps/desktop/scripts/browserEntryGuard.mjs,apps/desktop/vite.config.tsapps/desktop/src/utils/externalLinks.ts,apps/desktop/src/main.tsxapps/desktop/src/components/legal/CookiePolicyContent.en.tsxand.fr.tsx,docs/e2e-dm-spec.md(§7.3)apps/desktop/package.json,pnpm-lock.yamlCargo.lockgainstauri-plugin-opener2.7.3 and losestauri-plugin-shell,os_pipe,shared_child,encoding_rs,core_detectandmultiversion_no_op; no other package moves, and the tree still links onewebview2-com(0.39.1).pnpm-lock.yamlgains@tauri-apps/plugin-opener2.7.3 on the@tauri-apps/api2.12.4 already locked.Migrations
None.
Tests
apps/desktop/src-tauri, 43 unit tests):pickle_key_entry, the call the read and the write make, which the mock cannot show.'self',ipc:,http://ipc.localhostand ws(s) sources, sources with a path, credentials, queries and fragments, the firstconnect-srconly, the map form of the policy, the official policy, the debug-only loopback rule. The request URL on the checked base with?inline.cargo fmt --check,cargo check --locked,cargo check --locked --release,cargo clippy --locked --all-targets -- -D warningsandcargo test --lockedpass;cargo auditreports the six allowed warnings develop already has and nothing else.remove;forgetLocalE2EState(the vault goes before its key, a blocked or failing delete still removes the key, the bounded wait, never rejects); logout never calls it, also checked over the sources.force:logoutwhiledeleteAccountis pending: the page changes only once the vault and its key are gone, the pins removed and the trusted-device clear flushed, also when the answer arrives during the handler's token flush; a deletion that fails (409, 500, network error) erases nothing and the page still changes; the 90-second bound; the lost-session path waits the same way; a sign-in, the two-factor step, both sign-up steps, a password change and a session restore send nothing until the deletion has ended, and the cleanup clears nothing of the new session; with no deletion in flight both page changes happen right after their flush and a sign-in posts at once, as before.@tauri-appsstatically.javascript:,file:,tel:, a relative href,///x,//alone, another target, a click already taken and another button left alone; a link under an element, or inside a React portal, that stops the click's propagation still opened; a failure logged as a fixed line, with nothing of a rejection that carries the address; not installed in a browser.shell:, the opener scope exactly the three patterns), matching the compiledgen/schemas/capabilities.json; a self-hosted policy names the API origin exactly.pnpm typecheck,pnpm lintandpnpm build:desktoppass (the build guard included).pnpm test: server 4779 passed (145 files), desktop 3362 passed and 1 skipped (197 files), admin 153 passed (15 files).To check on an installed build
https://example.org,[mail](mailto:someone@example.org)and[rel](//example.org/a), and click each: the first and the third open in the system browser (the third ashttps://example.org/a), the second in the mail client, and no window opens inside the app. Signed out, on the sign-up page, open the Privacy Policy from its consent box and click a contact address and a web link (the CNIL's, for one): same result, from inside the modal. Post[x](/settings)and click it: nothing happens. (Atel:link cannot be checked in a message: the message renderer drops that scheme and renders the link with an empty address. The handler leavestel:to the webview, as its tests show.)%TEMP%\voxium_avatarsand repeat: the avatar is downloaded again and shown. While a notification arrives, the window stays responsive.app.voxium.e2e-pickle-keyin Windows Credential Manager (Generic Credentials). Sign out and back in: the entry and the encrypted history are still there. Delete the account from Settings: the app ends on the login page, and the credential-store entry is gone. In the browser build, do the same and check in the developer tools that the IndexedDB databasevoxium-e2e-v2-<userId>and the local-storage itemvoxium_e2e_pk_<userId>are gone and that the tab ends on the login page.pnpm tauri:buildfor a test server and install it under its own product and binary names. A notification from a user with an avatar shows the avatar, and links open in the system browser as in step 1.Issues: #121, #122, #123, #126