Skip to content

fix(desktop): mirror expired cookie deletions to the partner store - #66903

Open
gaurav0107 wants to merge 1 commit into
anomalyco:devfrom
gaurav0107:cookie-expired-overwrite
Open

gaurav0107 wants to merge 1 commit into
anomalyco:devfrom
gaurav0107:cookie-expired-overwrite

Conversation

@gaurav0107

Copy link
Copy Markdown

Issue for this PR

Closes #66896

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

When a site signs out with Set-Cookie: name=; Max-Age=0 (or a past Expires), Chromium reports a single expired-overwrite removal and no insert after it. The cookie mirror's listener skipped expired-overwrite together with overwrite, so the deletion was never copied to the other store and the cookie came back on the next bind.

The listener now skips only overwrite, whose insert event follows. An expired-overwrite goes through the normal reconcile path, which already handles removals: the other store's copy is removed.

How did you verify your code works?

  • Added a test to link.test.ts: the fake store gets an expire page action that drops the cookie and reports expired-overwrite, as Chromium does. The test expires a shared cookie on each side and checks both stores lose it. It fails on dev and passes with the fix.
  • bun test src/browser/profile/ in packages/gui-plugins: everything passes except the two electron-link tests, which need a real Electron binary I don't have locally (they fail the same way on dev).
  • bun typecheck in packages/gui-plugins and bun run lint:changed are clean.

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

🤖 Opened with Superhuman, an open-source contribution agent.

A site that signs out with Set-Cookie Max-Age=0 (or a past Expires) makes
Chromium report one "expired-overwrite" removal and no insert after it. The
cookie mirror skipped that cause along with "overwrite", so the deletion never
reached the other store and the cookie came back on the next bind.

Closes anomalyco#66896
@gaurav0107
gaurav0107 marked this pull request as ready for review November 28, 2026 00:13

@opencodejr opencodejr 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.

The fix works. In the pinned Electron 44.9.1, I ran the #66896 reproduction with a local server setting and then clearing session_token. On dev, a Max-Age=0 sign-out in the remote partition left the cookie in the profile. A past-Expires sign-out from the profile side left it in the remote partition. With this change, both stores lose the cookie in both directions. The mirror's own removal echoes back once and stops there, so there is no loop. Reconcile reads the current cookie from both stores, so the old value Chromium reports in an expired-overwrite event doesn't matter. Chromium inserts nothing after an expired-overwrite, so no remove-then-reinsert flip is possible.

link.test.ts, link-machine.test.ts and electron-link.test.ts pass, and the new test fails on dev as intended. tsc -b and oxlint on the changed files are clean.

Public API: unchanged.

No blocking concerns.

This branch has not been deployed

No deployments
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.

browser: CookieMirror drops Max-Age=0 / past-Expires cookie deletions ("expired-overwrite"), so deleted cookies come back on the next bind

1 participant