Repository navigation
Description
Preflight Checklist
- I have read the Contributing Guidelines for this project.
- I agree to follow the Code of Conduct that this project adheres to.
- I have searched the issue tracker for a feature request that matches the one I want to file, without success.
Problem Description
From time to time, issues arise when electron-based applications attempt to autodiscover user keyrings from XDG_CURRENT_DESKTOP when their desktop (which may be i3 or sway) does not match their assumed keyring (gnome-keyring can be used there, f.ex.).
This often leads to problems in packaging (should the maintainer attempt to build a heuristic for the user) and direkt problems for users which might be greeted with warnings after an update when autodiscovery failed:
- element-{web-unwrapped,desktop}: 1.11.100 -> 1.11.102 NixOS/nixpkgs#410555 (comment)
- Linux: An OS keyring couldn't be identified for storing the encryption related data in your current desktop environment microsoft/vscode#187338 (comment)
- No Keyring found, after update to 1.8 VSCodium/vscodium#1561
- Migrate from keytar to safeStorage element-hq/element-desktop#2227
The current default behaviour allows the user to easily choose an insecure password store backend, which users who are in a rush would just willingly click.
Proposed Solution
Use the freedesktop specified API for 'Secret Services' to discovery properly registered password store providers like a gnome-keyring running in a user sway session: https://specifications.freedesktop.org/secret-service-spec/latest/ref-dbus-api.html
VSCode has an issue about doing this itself in microsoft/vscode#185212, but no PR exists there either.
Alternatives Considered
Passing the --password-store=[gnome-keyring|...] command line flag will ensure this behaviour does not occur.
Downsides to this are, in my opinion:
- Launching Applications via
.desktopfiles is only possible if either- the file is modified (can lead to conflicts/silent replacements on package updates)
- or the application is only launched directly via CLI (could be annoying for the user)
- This shifts the problem (auto-discovery based on
XDG_CURRENT_DESKTOPnot being 'correct' and more of a good-enough heuristic) from the developer to the maintainer or even further down to a (unsuspecting) user.
Additional Information
No response
Activity
nazarewk commentedon Jun 16, 2025
yeah, I was extremely surprised today when Electron was complaining about lack of proper secret storage, while I am running a standard freedesktop SecretService (KeepassXC in my case, previously was running pass-secret-service)
transcaffeine commentedon Jun 21, 2025
Also see #39789
nazarewk commentedon Jun 23, 2025
To save you some time on digging through related discussions:
Use
--password-store=gnome-libsecretargument, which will force Electron to use the Secret Service API even if it's not exactly the gnome keyring.fix: element-desktop: use secret service
rrrnld commentedon Sep 17, 2025
Hitting this issue today as well, I discovered that electron will also try to use
gnome-libsecretwhen$XDG_CURRENT_DESKTOPcontainsGNOME, which is why I set it toniri:GNOME. I'm saying this as a potential alternative hotfix for people who don't want to or cannot pass the command line flag every time, but supporing standard discovery of the keyring as described in the opening post would solve the issue at a deeper level.fix(t14): force gnome-libsecret for teams-for-linux credential persis…
fix(t14): force gnome-libsecret for teams-for-linux credential persis…