Skip to content

fix(browser): align cookie import safeguards - #12607

Merged
brennanb2025 merged 5 commits into
mainfrom
brennanb2025/cookie-import-parity
Aug 5, 2026
Merged

brennanb2025 merged 5 commits into
mainfrom
brennanb2025/cookie-import-parity

Conversation

@brennanb2025

Copy link
Copy Markdown
Contributor

Summary

  • apply the Google source-bound cookie filter to file, Firefox, and Safari imports as well as native Chromium imports
  • replace existing cookies only for domains represented by the incoming snapshot, preserving unrelated signed-in sites
  • count filtered integrity cookies consistently in import summaries

Closes #12601

Screenshots

No visual change.

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test — focused browser-cookie suites run instead
  • pnpm build — no build-system or dependency changes
  • Added or updated high-quality tests that would catch regressions

Focused 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.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@brennanb2025, you've reached your PR review limit, so we couldn't start this review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a302331f-e80c-47c6-ac71-24a656a5ea75

📥 Commits

Reviewing files that changed from the base of the PR and between dacd366 and c3a72ef.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (8)
  • config/scripts/electron-vite-output-contract.test.ts
  • electron.vite.config.ts
  • package.json
  • src/main/browser/browser-cookie-import-policy.test.ts
  • src/main/browser/browser-cookie-import-policy.ts
  • src/main/browser/browser-cookie-import-replacement.test.ts
  • src/main/browser/browser-cookie-import.test.ts
  • src/main/browser/browser-cookie-import.ts
📝 Walkthrough

Walkthrough

The 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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the cookie import safeguard changes.
Description check ✅ Passed The description covers the required sections, testing status, security review, cross-platform review, and platform-specific notes.
Linked Issues check ✅ Passed The changes address issue #12601, including filtering, domain-scoped replacement, skip accounting, preservation, and native Chromium behavior.
Out of Scope Changes check ✅ Passed All production and test changes support the cookie import safeguards and regression coverage described in issue #12601.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between dc5c5a8 and dacd366.

📒 Files selected for processing (6)
  • src/main/browser/browser-cookie-import-policy.test.ts
  • src/main/browser/browser-cookie-import-policy.ts
  • src/main/browser/browser-cookie-import-replacement.test.ts
  • src/main/browser/browser-cookie-import-test-database.ts
  • src/main/browser/browser-cookie-import.test.ts
  • src/main/browser/browser-cookie-import.ts

@brennanb2025

brennanb2025 commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor Author

Electron QA

Passed on final SHA c3a72ef6a857d685b885b750a898e79715c10bca using Electron CDP with isolated user data. Settings → Browser rendered, Import Cookies opened, and Chrome, Safari, and File sources were present in the accessibility tree. This PR has no visual code changes; these screenshots document the unchanged entry surface.

Browser settings and Session & Cookies

Import cookie sources

@brennanb2025
brennanb2025 merged commit 38ba22e into main Aug 5, 2026
48 checks passed
@brennanb2025
brennanb2025 deleted the brennanb2025/cookie-import-parity branch August 5, 2026 19:51
@AmethystLiang

Copy link
Copy Markdown
Contributor

thanks for reporting. looking into it

@AmethystLiang

Copy link
Copy Markdown
Contributor

thanks for reporting. looking into it

enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* 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
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.

[Bug]: Cookie import paths apply inconsistent Google session safeguards

2 participants