You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Linux: secrets go to libsecret’s file backend when debugging from Rider (snap), not the Secret Service #205
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.
Category: Improvement (documentation, plus an optional diagnostic). This is not a CredentialCache bug. libsecret picks its own backend, and when it detects a sandbox (SNAP_NAME, or flatpak's equivalent) it uses the portal-keyed file backend (~/.local/share/keyrings/*.keyring) instead of the Secret Service. The library calls secret_password_*_sync, so it inherits that choice.
Priority: Low. Secrets still persist, and the file is still encrypted with a portal-supplied key. The real cost is surprise: where the data ends up depends on how the process was launched. This affects debugging from a snap IDE, and also any consumer that actually ships as a snap or flatpak.
Area / suggested assignment:README.md, the "Linux runtime prerequisites" and platform-notes sections. If the diagnostic is wanted, also CredentialCache/Storage/LinuxSecretServiceCredentialStore.cs, whose Name is a fixed string ("Linux libsecret (Secret Service)"). That is why Store.Name looked the same in both runs.
Add a README note: under snap or flatpak, or with SNAP_NAME set in the environment (Rider and other snap IDEs pass it to debugged processes), libsecret writes to its file backend rather than the Secret Service. Give the reporter's workaround: unset SNAP_NAME before the first store call in debug builds, or run the IDE outside the snap.
Optional: have Name (or a new property) report the backend libsecret will actually use. The store would detect the same sandbox signals libsecret checks, and avoid claiming "Secret Service" when it is not.
Check which SECRET_BACKEND value, if any, forces the service backend in the libsecret version Ubuntu ships, and document it if one works.
Thanks for the detailed report and the timestamp check. It makes the cause clear.
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.
Re-triaged because the reporter replied after the earlier triage.
Category: Improvement (documentation). This is still not a CredentialCache bug. The reporter confirmed that libsecret's own README documents the file-backend fallback, and they won't be investigating further.
Next step: The maintainer picks one: (a) add a short README note that a sandboxed launch (snap/flatpak, or SNAP_NAME inherited from a snap IDE such as Rider) makes libsecret use its portal-keyed file backend, with a link to libsecret's README, then close; or (b) close as upstream behaviour. The optional backend-reporting Store.Name from the earlier triage only needs doing if someone asks for it.
Activity
matt-edmondson commentedon Nov 6, 2026
Triage
SNAP_NAME, or flatpak's equivalent) it uses the portal-keyed file backend (~/.local/share/keyrings/*.keyring) instead of the Secret Service. The library callssecret_password_*_sync, so it inherits that choice.README.md, the "Linux runtime prerequisites" and platform-notes sections. If the diagnostic is wanted, alsoCredentialCache/Storage/LinuxSecretServiceCredentialStore.cs, whoseNameis a fixed string ("Linux libsecret (Secret Service)"). That is whyStore.Namelooked the same in both runs.SNAP_NAMEset in the environment (Rider and other snap IDEs pass it to debugged processes), libsecret writes to its file backend rather than the Secret Service. Give the reporter's workaround: unsetSNAP_NAMEbefore the first store call in debug builds, or run the IDE outside the snap.Name(or a new property) report the backend libsecret will actually use. The store would detect the same sandbox signals libsecret checks, and avoid claiming "Secret Service" when it is not.SECRET_BACKENDvalue, if any, forces the service backend in the libsecret version Ubuntu ships, and document it if one works.Thanks for the detailed report and the timestamp check. It makes the cause clear.
Generated by Claude Code
oopsypoo commentedon Nov 6, 2026
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.
matt-edmondson commentedon Nov 6, 2026
Triage
Re-triaged because the reporter replied after the earlier triage.
README.md, Linux runtime prerequisitesSNAP_NAMEinherited from a snap IDE such as Rider) makes libsecret use its portal-keyed file backend, with a link to libsecret's README, then close; or (b) close as upstream behaviour. The optional backend-reportingStore.Namefrom the earlier triage only needs doing if someone asks for it.Thanks again for following up on this.
Generated by Claude Code