Skip to content

Linux: Use Secret Service API in DBus to attempt to autodiscover secret provider #47436

Description

@transcaffeine

Preflight Checklist

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:

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 .desktop files 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_DESKTOP not 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

  1. nazarewk commented on Jun 16, 2025

    @nazarewk

    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)

  2. transcaffeine commented on Jun 21, 2025

    @transcaffeine
    Author

    Also see #39789

  3. nazarewk commented on Jun 23, 2025

    @nazarewk

    To save you some time on digging through related discussions:

    Use --password-store=gnome-libsecret argument, which will force Electron to use the Secret Service API even if it's not exactly the gnome keyring.

  4. rrrnld commented on Sep 17, 2025

    @rrrnld

    Hitting this issue today as well, I discovered that electron will also try to use gnome-libsecret when $XDG_CURRENT_DESKTOP contains GNOME, which is why I set it to niri: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.

  5. self-assigned this
    on Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions