fix(desktop): read Chromium cookies stored as text #19377
main fromrefs/pull/19377/head·merged by juliusmarminge View on GitHubOne SQLite TEXT value in Chromium’s BLOB-affinity encrypted_value column could abort the entire cookie import during schema decoding. Cast that column to BLOB in SQLite in both query paths, before Node can decode encrypted bytes as UTF-8. No migration or write to the source browser database is involved.
Thanks @deanhtid for the diagnosis and fix in #19377. Maintainer takeover preserves the contributor history, merges current main, and consolidates overlapping database tests. This is a focused repair to the existing import path; authentication-sensitive data still requires human review.
Verification on headless Linux:
ChromiumCookies.test.ts: 16 → 15 tests. The two parameterized database cases cover schema 14 and schema 24, mixed plaintext TEXT, encrypted TEXT, encrypted BLOB, and genuinely empty values. Successful decryption verifies payload bytes and modern domain binding.- Before: restoring main’s production reader yields 13 passing tests and 2
SchemaError: Expected Uint8Arrayfailures. After: all 15 pass. - Desktop typecheck, targeted lint, formatting, and whitespace checks pass. The five focused cookie/key suites pass (68 tests), and the importer integration suite passes (5 tests). Tests bypass Electron’s executable-path lookup; no Electron process launches.
Real Chromium/Electron import was not verified: the VM’s Chromium binary cannot start because libcups.so.2, libcairo.so.2, and libpango-1.0.so.0 are unavailable. Proof is at the SQLite/decryption test level using synthetic data; no real cookies or credentials were accessed. Windows, macOS, iOS, Android, and Electron desktop were not exercised. Human approval and a real-browser import remain the final validation limits.
Implementation: GPT-6.1-Sol; tests: GPT-6-Astra; independent reviews: Claude Opus 5.5 and GPT-6-Sol. Orchestrated in T3 Code through the Codex harness.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XS
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Advanced
- Run ID:
cd11fd2b-a478-4203-bf12-ca71df723248
📥 Commits
-
Reviewing files that changed from the base of the PR and between 4a578681b142e5d13a4f61ee17f4f86800e36d3f and 222190125cdc6b042ec310e010b6ba44b726d4d8.
📒 Files selected for processing: 2
-
apps/desktop/src/preview/BrowserImport/ChromiumCookies.test.tsapps/desktop/src/preview/BrowserImport/ChromiumCookies.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
-
📝 Walkthrough
-
The Chromium cookie database reader casts
encrypted_valueto BLOB in both schema-version query branches. Tests cover schema versions 14 and 24, including plaintext, encrypted TEXT and BLOB values, and empty values.Changes: Chromium cookie reading
Layer / File(s) Summary Encrypted value decoding
apps/desktop/src/preview/BrowserImport/ChromiumCookies.ts,apps/desktop/src/preview/BrowserImport/ChromiumCookies.test.tsBoth schema-version query branches cast encrypted_valueto BLOB. Tests cover schema versions 14 and 24 and verify plaintext, encrypted TEXT and BLOB values, empty values, and zero undecryptable records.Priority: ⬇️ Low
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix
Suggested reviewers:
juliusmarminge
Merge Risk: ⚪ Minimal · up to
22219-
No actionable issue is identified; the change appears ready for normal merge checks.
Architecture Summary#
Architecture risk: 🔵 Low · up to
22219The change affects 1 system.
Changed systems:
apps/desktopArchitecture concerns No architecture-level concerns identified.
Review details
-
Systems and components
- observed — apps/desktop (service) was modified; 2 changed files map to changed impact.
Before / after behavior
- observed — Modified behavior in apps/desktop/src/preview/BrowserImport/ChromiumCookies.test.ts: Replaced the schema-23-only fixture with tests for schema versions 14 and 24, conditionally adding
top_frame_site_keyfor versions 15 and newer and applying SHA-256 host binding for version 24. The fixture now verifies plaintext cookies, encrypted values stored as both TEXT and BLOB, and genuinely empty values, expecting all four cookies to import successfully with no undecryptable records. - observed — Modified behavior in apps/desktop/src/preview/BrowserImport/ChromiumCookies.ts: Both schema-version query branches now cast
encrypted_valueto BLOB before returning it from SQLite; the previous uncast column selection was removed.
Pre-merge checks:
4-
Check name Status Explanation Title check The title clearly identifies the desktop Chromium cookie import fix and matches the primary changes in the pull request. Description check The description explains the problem, implementation, scope, verification results, and validation limits. It does not use the template headings and does not include an explicit maintainer approval com… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Full details: Description check
-
Explanation
The description explains the problem, implementation, scope, verification results, and validation limits. It does not use the template headings and does not include an explicit maintainer approval comment, but it provides the required information sufficiently for a focused fix.
-
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
-
juliusmarminge assignedjuliusmarminge
Taking over this one as maintainer for desktop-app-03. I will preserve the contributor commits, merge current main, verify byte-preserving cookie reads with minimal regression coverage, and obtain independent reviews. No merge is planned.
juliusmarminge merged this62144bf
juliusmarminge closed this
Reverting this in #22222 together with the other desktop fixes the takeover campaign merged yesterday. Nothing was wrong with the review of this change; it was merged on CI and code audits only, and after #20907 from the same batch broke existing installs the maintainer decided that desktop changes do not ship without being run on a real desktop build. To bring it back: open a fresh PR from the original commit, run it on a real build that already has user state on each platform it touches, and put the before/after proof in the body.
Sign in to join this conversation.
Approvability#
Verdict: Not approved
Macroscope's review found this PR not approvable — The production change alters Chromium cookie import so encrypted values stored as SQLite TEXT can be converted to bytes and decrypted, affecting authentication-sensitive browser data. Although narrowly scoped and covered by regression tests, this sensitive-data path warrants human review.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).