Skip to content

feat(masterkey): decrypt Chromium v12 portal keys - #707

Merged
moonD4rk merged 2 commits into
mainfrom
feat/chromium-v12-portal
Nov 20, 2026
Merged

moonD4rk merged 2 commits into
mainfrom
feat/chromium-v12-portal

Conversation

@moonD4rk

@moonD4rk moonD4rk commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

What

Adds Linux support for Chromium's v12 cipher (the SecretPortalKeyProvider, used by Flatpak and by desktops where Chromium encrypts with the XDG desktop portal). Closes #580.

v12 values are sealed as v12 + 12-byte nonce + AES-256-GCM, where the key is HKDF-SHA256(portal app secret, salt "fdo_portal_secret_salt", info "HKDF-SHA-256 AES-256-GCM"). The 64-byte per-app secret already lives in the Secret Service; HBD reads it and derives the key. It never calls the portal's RetrieveSecret, which would create an entry when one is missing.

How

  • crypto: HKDFKey built on the stdlib HMAC (Go 1.20 has no crypto/hkdf, and the project takes no x/crypto dependency). Verified against the RFC 5869 A.1–A.3 vectors.
  • masterkey (Linux): a portalRetriever (version v12) after the v10/v11 retrievers. It looks the secret up by app id — gnome-keyring's xdg:schema+app_id, then ksecretd's server+user — and reads it with Service.GetSecrets, the one call both backends answer (gnome-keyring never exports its portal item objects, and GetSecrets is mandatory in the Secret Service API, so there is no per-item fallback). The search+unlock step is shared with the v11 path. With no portal secret the retriever steps aside (errNotApplicable).
  • browser: Platform.PortalAppID on the chrome / chromium / chrome-beta / brave Linux rows; the key locator resolves a single app id — a Flatpak install's id is fixed by its sandbox and taken from the .var/app/<id>/ path, otherwise the registered id applies.
  • chromium: the v12 placeholder is replaced with real AES-256-GCM decryption.

Compatibility

v10/v11/v20 and DPAPI paths are untouched; the v11 retriever keeps its exact behavior (the existing tests pass unchanged). macOS and Windows are unaffected (the portal code is //go:build linux).

Note on error rows: Chromium registers a portal secret even when it is not yet encrypting with v12, so for the four configured browsers dumpkeys now also exports a v12 key (unused until a v12 value appears), and if the keyring/wallet is locked these dirs' failure detail gains a v12: keyring or wallet is locked line next to the v11 one — the row count is unchanged. A browser with no portal app id (Edge/Vivaldi/Opera/Yandex, whose portal id is the empty string) is not covered yet; that is no regression, since v12 was fully unsupported before.

Testing

  • Unit: HKDF RFC vectors, a fixed portal-key vector, TestFindPortalSecret and TestPortalAppID tables, and a decryptValue v12 round trip. Green on darwin and in a golang:1.20-bookworm container; GOOS=linux golangci-lint clean; a 5-mutation check caught all 5 (no test gaps).
  • Real desktops (GNOME + KDE VMs), recovered/total cookies, counts only:
    • GNOME v12: Chrome 10/14 → 14/14, Flatpak Chromium 25/29 → 29/29.
    • KDE v12: Chrome 0/3 → 3/3, Flatpak Chromium 15/18 → 18/18.
    • No regression: GNOME data 34/34 and KDE kde-data 18/18 before and after, with zero master-key errors.
    • ksecretd (KWallet 6.24) implements GetSecrets (confirmed by D-Bus introspection), so the single read path covers both desktops.

v12 derives its key with HKDF-SHA256 over the XDG desktop portal's
per-app secret, read via the Secret Service; v10/v11 stay unchanged.

Closes #580
Copilot AI balanced review requested due to automatic review settings November 19, 2026 10:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Address review: single PortalAppID (a Flatpak sandbox fixes the id, so
it never falls back to the table id), GetSecrets-only (no unreachable
per-item fallback), drop the hkdfParams wrapper, and use stillLocked
instead of a shadowed named return (fixes a lll violation on Linux).
@moonD4rk
moonD4rk merged commit fe8a1bb into main Nov 20, 2026
9 checks passed
@moonD4rk
moonD4rk deleted the feat/chromium-v12-portal branch November 20, 2026 02:10
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.

Support Chromium v12 ciphertexts (SecretPortal / Flatpak) on Linux

2 participants