Repository navigation
feat(masterkey): decrypt Chromium v12 portal keys - #707
Merged
Merged
Conversation
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
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 isHKDF-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'sRetrieveSecret, which would create an entry when one is missing.How
HKDFKeybuilt on the stdlib HMAC (Go 1.20 has nocrypto/hkdf, and the project takes nox/cryptodependency). Verified against the RFC 5869 A.1–A.3 vectors.portalRetriever(versionv12) after the v10/v11 retrievers. It looks the secret up by app id — gnome-keyring'sxdg:schema+app_id, then ksecretd'sserver+user— and reads it withService.GetSecrets, the one call both backends answer (gnome-keyring never exports its portal item objects, andGetSecretsis 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).Platform.PortalAppIDon 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.v12placeholder 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
dumpkeysnow also exports a v12 key (unused until a v12 value appears), and if the keyring/wallet is locked these dirs' failure detail gains av12: keyring or wallet is lockedline 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
TestFindPortalSecretandTestPortalAppIDtables, and adecryptValuev12 round trip. Green on darwin and in agolang:1.20-bookwormcontainer;GOOS=linux golangci-lintclean; a 5-mutation check caught all 5 (no test gaps).data34/34 and KDEkde-data18/18 before and after, with zero master-key errors.GetSecrets(confirmed by D-Bus introspection), so the single read path covers both desktops.