Repository navigation
fix(browser): align cookie import safeguards - #12607
Conversation
|
Warning Review limit reached
Next review available in: 1 minute You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (8)
📝 WalkthroughWalkthroughThe change adds shared cookie-import policy utilities for Google source-bound cookie detection, domain normalization, and imported-domain replacement. File, Firefox, and Safari imports now replace overlapping cookies before loading validated cookies. Chromium imports use the shared source-bound cookie check and include skipped cookies in summaries. Tests cover domain matching, removal URLs, invalid scopes, replacement failures, native Chromium cookie accounting, and mocked cookie-store behavior. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: ebb2359a-f9f3-4e12-a988-f9237e0db336
📒 Files selected for processing (6)
src/main/browser/browser-cookie-import-policy.test.tssrc/main/browser/browser-cookie-import-policy.tssrc/main/browser/browser-cookie-import-replacement.test.tssrc/main/browser/browser-cookie-import-test-database.tssrc/main/browser/browser-cookie-import.test.tssrc/main/browser/browser-cookie-import.ts
Electron QAPassed on final SHA |
|
thanks for reporting. looking into it |
|
thanks for reporting. looking into it |
* fix(browser): align cookie import safeguards * fix(browser): preserve sessions on failed cookie imports * fix(browser): bound single-label cookie replacement * fix(browser): preserve host-only parent cookies * fix(build): bundle cookie scope parser


Summary
Closes #12601
Screenshots
No visual change.
Testing
pnpm lintpnpm typecheckpnpm test— focused browser-cookie suites run insteadpnpm build— no build-system or dependency changesFocused result: 3 files passed, 34 tests passed.
AI Review Report
Reviewed the shared import policy, native Chromium path, and the file/Firefox/Safari setter path together. The review checked domain-bound filtering, replacement-before-set ordering, unrelated-cookie preservation, skip accounting, failure behavior, and suffix-confusion cases such as
google.com.evil.example.Cross-platform review: the new policy uses Electron's cookie API and URL/domain normalization with no OS branches, paths, shells, shortcuts, or platform labels. The existing native browser discovery/version behavior remains unchanged on macOS, Linux, and Windows.
Security Audit
Cookie names and domains remain untrusted input. Domains are normalized through
URL, empty/invalid scopes are rejected, Google matching is label-bound, and replacement is limited to exact/parent/child scopes of imported domains. A failed destination-cookie read/removal fails closed before any incoming cookie is set. No command execution, secrets logging, dependency, auth-token, or new IPC surface is introduced.Notes
Native Chromium imports continue to replace the full destination snapshot. File, Firefox, and Safari imports use domain-scoped replacement because those inputs are not guaranteed to represent the user's entire browser jar.