Skip to content

fix(masterkey): resolve Linux v11 keys via Secret Service - #705

Open
moonD4rk wants to merge 3 commits into
feat/firefox-primary-passwordfrom
fix/linux-secret-service-lookup
Open

moonD4rk wants to merge 3 commits into
feat/firefox-primary-passwordfrom
fix/linux-secret-service-lookup

Conversation

@moonD4rk

@moonD4rk moonD4rk commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

Fixes Linux v11 master-key retrieval on GNOME and KDE. Refs #572, #161 (not fully resolved here — see note).

Stacked on #704 (base feat/firefox-primary-password); GitHub retargets to main as the stack merges.

Problem

The Secret Service lookup enumerated a collection's items and matched the label exactly:

  • GNOME: a login keyring that lists stale item paths (7 of 10 here) makes a whole-collection read abort, so the live key is never reached — v11 reads "not found" even while unlocked.
  • KDE: KWallet exposes entries over Secret Service as <X> Keys/<X> Safe Storage, so an exact match misses them.

Fix

Rewrite dbusRetriever on godbus directly and drop the go-dbus-keyring dependency:

  • SearchItems by libsecret's schema (GNOME), KWallet's schema, and KWallet's user attribute (the entry name), so the lookup does not depend on the schema label KWallet sets.
  • Match the label exactly or by /-suffix, reading items one by one so a stale path is skipped.
  • Unlock only what opens without a prompt; a match hidden behind a locked keyring or closed wallet reports keyring or wallet is locked instead of not found.
  • Every D-Bus call is bounded by a timeout.

Validated on real desktops (seeded fake data, author's VM, wallet open)

  • GNOME: v11 recovered for all 6 vaults; 34 cookies / 2 passwords all ok.
  • KDE: v11 recovered via the suffix match; 18 cookies all ok.

The follow-up commit (locked error, user query, bounded calls) is unit-tested and checked against KWallet's ksecretd source, but not yet re-run on the VM.

Follow-ups

#161's environment (Ubuntu 22.04 + kdewallet5) has no Secret Service at all, so it needs native KWallet over D-Bus (3b). Refs #572, #161 — kept open for that.

Test

go test ./... + linux masterkey tests (incl. the label-match table) + golangci-lint clean; go mod tidy kept go 1.20.

Enumerating a collection and matching the label exactly missed keys:
a GNOME keyring listing stale item paths aborted the whole read, and
KWallet labels entries "<X> Keys/<X> Safe Storage". Use SearchItems
(live items only) and match the label by suffix.
A locked wallet now reports "locked" instead of "not found", every
D-Bus call (label read, session close) is bounded by the timeout, and
the lookup also searches by KWallet's user attribute so it no longer
depends on the xdg:schema label. The label match is a tested pure func.
@moonD4rk
moonD4rk force-pushed the fix/linux-secret-service-lookup branch from f683048 to fd9f3b0 Compare November 18, 2026 09:23
@moonD4rk
moonD4rk added this pull request to stack #706 November 18, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant