Skip to content

feat(browser): enable real OS cookie encryption, CefCookieManager, remote cookie mirror, and Rust cookie importer - #286

Merged
Hona merged 6 commits into
devfrom
ws1-phase3b
Nov 21, 2026
Merged

Hona merged 6 commits into
devfrom
ws1-phase3b

Conversation

@Hona

@Hona Hona commented Nov 20, 2026

Copy link
Copy Markdown
Member

Summary

Implements Phase 3b of UP-095 (#63002) — real OS cookie encryption, CefCookieManager profile operations, loop-free two-way remote cookie mirroring, "Sign out everywhere", and the cross-browser / cookie-file Rust importer & Choose-sites backend (apps/browser-engine, crates/browser-pane) with zero new external crates:

  • Real OS cookie encryption (apps/browser-engine/src/engine.rs): Removes --use-mock-keychain so Chromium encrypts cookies with Windows DPAPI, macOS Keychain, or Linux Secret Service/KWallet, and adds the startup PROBE_COOKIE (cookie-check.opencode.invalid) flow (ProfileProbeCookies + cookies::database::probe_disk_cookies) so the app can detect denied Keychain / locked keyring sessions.
  • CefCookieManager, Sign out everywhere & remote cookie mirror (apps/browser-engine/src/cookies.rs):
    • Additive wire.rs / protocol.rs messages gated by Ready { cookies: true }: ProfileCookiesList, ProfileCookiesSet, ProfileCookieDelete, ProfileProbeCookies, ClearProfileData, SetShareSignIns, SyncRemoteCookies.
    • Zero-cookie-safe CefCookieVisitor, __Host- host-only enforcement, and probe-cookie invisibility.
    • "Sign out everywhere" (ClearProfileData) clears HTTP auth credentials (with a valid CompletionCallback), open-tab origin storage/caches (skipping IsolatedPreview), and wipes cookies on both Default and all active RemoteServer partitions.
    • Two-way remote cookie mirror (reconcile_cookie, exact link-machine.ts parity): off by default, never touches IsolatedPreview, and wipes shared remote partition cookies immediately when turned off.
  • Zero-new-crate Rust cookie importer & Choose sites (crates/browser-pane/src/cookies/*):
    • Reuses locked workspace crates (ring 0.17, rusqlite 0.41, windows 0.62, security-framework 3.7) plus pure-Rust #![forbid(unsafe_code)] FIPS-197 AES-128-CBC and RFC 3492 Punycode.
    • Supports all 15 external browsers (Chrome, Edge, Helium, Brave, Arc, Dia, Comet, Vivaldi, Opera, Chromium, Safari, Firefox, Zen, LibreWolf, Floorp), private 0o700 SQLite + WAL snapshots, in-process Windows DPAPI (CryptUnprotectData), macOS Keychain, Linux secret-tool, DB v24 SHA256(host) prefix stripping, v20 Protected classification, CHIPS exclusion, Firefox default-container + 139+ ms expiry, bounds-checked Safari Cookies.binarycookies, and Netscape / Chrome JSON / Playwright cookie files (<= 32 MiB).
    • Exposes BrowserHost::{engine_cookies, share_sign_ins, set_share_sign_ins, request_profile_cookies, import_profile_cookies, delete_profile_cookie, probe_profile_cookies, clear_profile_data, sync_remote_cookies, take_profile_events} ready for Settings > Browser.

Verification

  • scripts/guardrails.ps1: 5/5 passed (0 errors; 0 new files > 800 lines)
  • cargo clippy -p browser-pane --features engine --no-deps -- -D warnings: 0 warnings
  • cargo check -p browser-pane --no-default-features, cargo check --workspace, scripts/web.ps1 -Check, apps/browser-engine build: all passed with 0 warnings
  • Live CEF 156 IPC proof (11/11 scenarios): Ready.cookies: true, batch import (__Host- host-only, expired reject), probe write/hide/delete, default isolation, two-way Default <-> RemoteServer mirroring, disable-sharing remote wipe, ClearProfileData full wipe, on-disk Local State "DPAPI" + 77-byte v10 encrypted cookie with empty plaintext value, and cross-restart persistence
  • Live Rust importer proof (8/8 scenarios): dpapi_unprotect + read_chromium_cookies decrypted the actual live CEF 156 Windows DPAPI cookie DB (dpapi_check=supersecret123), FIPS-197 AES-128-CBC + PBKDF2 + v20, Netscape/Chrome JSON/Playwright files, Choose-sites PSL/private-tenant/Punycode/IPv6 grouping, Firefox default-container/ms-expiry, Safari bounds-checked binarycookies, and probe_disk_cookies locked-keyring detection

…mote cookie mirror, and Rust cookie importer

Implements Phase 3b of `UP-095` (`#63002`) across `apps/browser-engine` and
`crates/browser-pane` with zero new external crates (reusing locked `ring`, `rusqlite`,
`windows`, and `security-framework`):

- **Real OS cookie encryption (`apps/browser-engine/src/engine.rs`):** Removes
  `--use-mock-keychain` so Chromium encrypts profile cookies with the real OS key store
  (Windows DPAPI, macOS Keychain, Linux Secret Service/KWallet), paired with a short-lived
  startup persistence probe cookie (`cookie-check.opencode.invalid`) to detect denied
  Keychain or locked keyring sessions (`probe_disk_cookies`).
- **`CefCookieManager` & loop-free remote cookie mirror (`apps/browser-engine/src/cookies.rs`):**
  Adds additive wire messages (`Ready.cookies`, `ProfileCookiesList`, `ProfileCookiesSet`,
  `ProfileCookieDelete`, `ProfileProbeCookies`, `ClearProfileData`, `SetShareSignIns`,
  `SyncRemoteCookies`) with zero-cookie-safe `CefCookieVisitor`, `"Sign out everywhere"`
  (clears cookies, HTTP auth credentials via completion callback, and site storage/caches
  across default + remote partitions), and exact `link-machine.ts::reconcileCookie` two-way
  remote mirroring (off by default; wipes remote partition cookies when turned off; never
  mirrors `IsolatedPreview` contexts).
- **Pure-Rust cookie importer & Choose-sites backend (`crates/browser-pane/src/cookies/*`):**
  Discovers all 15 Chromium/Firefox/Safari browsers across Windows/macOS/Linux; reads live
  SQLite DBs from private `0o700` WAL snapshots; decrypts Windows DPAPI + AES-256-GCM and
  macOS/Linux PBKDF2 + pure-Rust FIPS-197 AES-128-CBC (stripping Chromium DB v24
  `SHA256(host)` prefixes and reporting `v20` app-bound cookies as `Protected`); parses
  Safari `Cookies.binarycookies` and Netscape/Chrome-JSON/Playwright exports (<= 32 MiB);
  and groups registrable sites (PSL + private hosting tenants + RFC 3492 Punycode) without
  reading or decrypting cookie values for the Choose-sites list.
@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

PR test build retired — merged into dev. Install or auto-update OpenCode (Rune) from https://anoma.ly/release/opencode/desktop-rune/dev/macos-arm64-dmg.

Hona added a commit that referenced this pull request Nov 20, 2026
…18..UP-122 (#295)

- Fold verified fleet PRs #278, #285, #287, #288, #289, #290, #291, and
  #293 (Rune dc8f7f72: #1301, #1302 focus rescue verified Send+Enter -> effort)
  into docs/upstream-sync/ledger.{json,md}
- Close UP-062 packaged-default regression (#278), UP-095-UI / UP-100 /
  UP-106 / UP-109 / UP-117 (#285, #289), and PRE-08 (#287); reassign
  UP-115, UP-116, UP-075 to BROWSER-UI
- Add separate Reviewed column for browser rows tracking retrospective
  security reviews on merged PRs (#245, #268, #272, #277, #288, #275, #287,
  #285, #289) and pre-merge holds (#274, #280, #281, #283, #286, #292, #294,
  and BROWSER-TOOLS PR 3+)
- Audit upstream anomalyco/opencode bfee96a859..2002222d13 (+6 commits:
  1 skipped, 5 added: UP-118..UP-122) and refine radar routing
Hona added 4 commits November 21, 2026 11:26
# Conflicts:
#	apps/browser-engine/src/context.rs
#	apps/browser-engine/src/engine.rs
#	apps/browser-engine/src/main.rs
#	apps/browser-engine/src/wire.rs
#	crates/browser-pane/src/client.rs
#	crates/browser-pane/src/lib.rs
#	crates/browser-pane/src/machine.rs
#	crates/browser-pane/src/protocol.rs
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