Repository navigation
fix(cursor): keep usage cookies on the resolved account - #25243
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (1)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (4)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughDashboard requests now omit Electron session-jar credentials and continue to send the selected account cookie in their headers. A new Electron integration test exercises quota transport over HTTP and HTTPS, including account and cookie combinations, parallel requests, legacy responses, and failure scenarios. It also checks cookie-jar state, request receipts, and cleanup. Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The change is ready for normal checks. No actionable merge-blocking issue was established, though the new test’s ability to catch a future removal of the credential option remains unverified. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change narrows credential use to the selected account and preserves redirect blocking. No introduced security defect was identified in the reviewed request path. Remaining uncertainty concerns real-provider compatibility and behavior outside the covered Electron transport scenarios. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 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.
✅ No new issues found.
Reviewed changes
credentials: 'omit'on the Cursor dashboard request —fetchDashboardJsoninsrc/main/rate-limits/cursor-fetcher.tsnow tells Electron to send only the explicitly supplied accountCookieinstead of merging the session jar's cookie, so a stale/jar cookie can no longer substitute another account's allowance. Both/api/usage-summaryand the legacy/api/usagefallback go through this helper.- Unit assertion —
src/main/rate-limits/cursor-fetcher.test.tspinsinit.credentials === 'omit'. - Real-transport regression —
tests/e2e/cursor-quota-transport.unit.test.tsand itscursor-quota-wire.fixture.tsbuild a fixture with vite, launch it under real Electron viaresolveElectronProbeLaunch+createElectronHomeIsolation, and record which synthetic account's Cookie reaches a loopback server across account/jar combinations, failure modes, the legacy path, jar mutation, and blocked redirects.
I confirmed the new E2E test is not theatre: removing credentials: 'omit' makes it fail at the jar-A-B arm with used: 25 instead of 75 — the exact reported ownership defect. The fix was restored and the tree left clean. PR-head CI is green (all unit shards, relay integration, package on Linux and Windows, static analysis and typecheck).
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
Backport upstream stablyai#25243 so Electron's cookie jar cannot replace the selected Cursor account's explicit Cookie on usage requests. Include the upstream native HTTP/HTTPS regression tests and request assertion. Upstream-commit: 6c07570 Credit: Li-Sanze, jjongsta, and chengjiaxiao for the upstream fix and reports. Co-authored-by: Codex <[email protected]>

ELI5
Cursor quota should belong to the account Orca resolved. Electron's existing cookie jar could replace that account's Cookie and return another account's allowance or an expired-sign-in error.
What Changed
Set
credentials: 'omit'on the existing shared dashboard request so Electron uses the supplied selected-account Cookie and ignores response cookies. Both the summary and legacy endpoints use this option. Account discovery, CSRF headers, expiry checks, timeout, failure classification and redirect blocking stay in the existing implementation.Add a real Electron HTTP/HTTPS regression covering selected-account isolation, empty jars, token replacement, concurrent accounts, response-cookie isolation, both endpoints, failures and blocked redirects. The fixture reuses the supported native probe launcher and records child/fixture diagnostics.
Why
With A in Electron's jar, selecting B previously returned A's 25% allowance; the fix returns B's 75%. One request option solves that demonstrated ownership defect without global cookie writes, account races or a new session lifecycle.
The historic empty-jar 401 / populated-jar 200 report did not reproduce on installed Electron 43.7.5. This PR does not claim a real Cursor token was accepted or that every affected user's original sign-in problem is repaired.
Linked Issue
Refs #23612 — #23612
Credit @Li-Sanze's classification contribution in #23626, retained through merged #24575. @jjongsta and @chengjiaxiao's reports prompted the native session/header comparisons; the account-substitution finding here differs from the reported empty-jar outcome. Keep the original issue open.
Visual Proof
N/A — request transport only; no renderer or interaction changes. Native fixture servers record the synthetic account whose Cookie actually arrived.
Testing
The exact full four-path patch applies without conflict to current main
ddefd523e052cc83897937569d322a727f55dd78; local validation copy4b83be1ab03407bfe1818ccf92f1d73a5307f3afhas no unrelated changes. Published PR head remains2303aef019304b4a6200d51872c5d5c6e2f98956.On macOS arm64, Electron 43.7.5 / Chromium 150.0.7871.250:
pnpm tc, focused new-fixture E2E typecheck, four-path format check, changed-code-quality gate and normal commit lint/format hooks pass on current main.Separate accepted independent validation on the pinned main snapshot: 11 suites / 112 tests passed, with node and focused fixture typechecks, changed-code-quality and format checks passing, plus actual HTTP proxy controls. These results overlap the author’s 9-suite / 65-test run and native controls above; do not sum them into a unique-test total or treat the independent HTTP controls as proof of additional platforms.
Published-head CI has 13 successful / 17 skipped checks. The named native Linux job checks out
5c668f88a171c6370759791c0aafb06a28dbcf71, merging this PR head intoea6a6d60774ac2b74bb6692d1798e3ab13b99ae0, and explicitly passes the Cursor credential-independence test. Hosted static/typechecks, all selected unit shards, relay integration, Linux packaging and Windows packaging pass; skips are not executions. This is historical published-head integration evidence, while the newer current-main snapshot has the local proof above.The earlier f2c Linux exit 133 remains unexplained; successor-head named native acceptance passes without weaker assertions, retries or skips. Full local lint/build/all-tests were not repeated; broader published CI checks cover its explicit integration base.
No provider calls, login, paid-model requests, keychain reads or real credential/config access. Actual Windows native transport, live SSH, authenticated Cursor backend acceptance, other Electron versions and enterprise authentication schemes remain untested. Those gaps do not add a new platform/host/wire mechanism to this request-option change.
Review
The complete four-path independent review was accepted as CLEAR / Low merge risk for published head
2303aef019304b4a6200d51872c5d5c6e2f98956, validated as4b83be1ab03407bfe1818ccf92f1d73a5307f3afon pinned mainddefd523e052cc83897937569d322a727f55dd78. This covers the production option and both native fixture/launcher-diagnostic paths, rather than only an earlier increment. Keep this PR draft; review acceptance does not authorize merging or issue closure.Agent skill upstream boundary
Notes
Deliberate tradeoff: exclude automatic origin session authentication and response-cookie persistence; authenticate through the explicitly selected account token. The guarded default session still owns proxy routing. No provider selection, credential refresh, account cache, RPC/schema, SSH routing, UI, folder workspace, Git-provider, Cursor Chat/history or dependency changes.
The original empty-jar issue remains unresolved. This PR fixes a separately reproduced account ownership defect and does not authorize issue/predecessor closure, readiness changes or merging.
Checklist