Skip to content

Linux: secrets go to libsecret’s file backend when debugging from Rider (snap), not the Secret Service #205

Open

Description

@oopsypoo

Hi, and thanks for the library. I ran into something that I don’t think is a bug in CredentialCache itself, but it might save other Linux users some time, so I’m sharing it.

What I saw

.NET app using ktsu.CredentialCache on Kubuntu (KDE).
Run from a terminal (dotnet run or the built binary): the secrets show up in the Secret Service (KWallet), under my app’s service name.
Run/debug from JetBrains Rider (installed as a snap): Store.Name and the service name are identical, and values persist across reboots. But nothing appears in the Secret Service and there is no org.freedesktop.secrets traffic on D-Bus.

Cause
Rider’s snap sets SNAP_NAME in the environment of the debugged process. libsecret appears to treat that as a sandbox and switches to its file backend: ~/.local/share/keyrings/default.keyring, with the key fetched through the desktop portal. I confirmed it by checking the file’s timestamp:

SNAP_NAME=rider dotnet run changes default.keyring.
Without SNAP_NAME, it stays unchanged.
An empty SNAP_NAME= still triggers it.
SECRET_BACKEND=service did not override it (I’m not sure that’s the right value).

Workaround
Call libc’s unsetenv("SNAP_NAME") via P/Invoke at the very start of Main in debug builds, or run Rider outside the snap.

Suggestions (only if they fit the project)

A short note in the README’s Linux section.
If possible, a way to see which libsecret backend is active, since Store.Name looked the same in both cases.

Environment: Kubuntu 26.04.1 LTS, Rider 2026.2.4.1 (snap, classic), .NET 10, libsecret [version, from dpkg -l libsecret-1-0].

Activity

  1. matt-edmondson commented on Nov 6, 2026

    @matt-edmondson
    Contributor

    Triage

    Thanks for the detailed report and the timestamp check. It makes the cause clear.


    Generated by Claude Code

  2. oopsypoo commented on Nov 6, 2026

    @oopsypoo
    Author

    I looked at https://github.com/GNOME/libsecret
    And it is allready "documented" at the top of their README-file. I'm not going to investigate any further. Thanks for the reply:
    A GObject-based library for storing and receiving secrets. libsecret provides a convenient wrapper around two different mechanisms: If available, secrets are stored in the freedesktop secret service. Otherwise, secrets are stored in a file that is encrypted using a master secret that was provided by the secret portal.

  3. matt-edmondson commented on Nov 6, 2026

    @matt-edmondson
    Contributor

    Triage

    Re-triaged because the reporter replied after the earlier triage.

    Thanks again for following up on this.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions