Clear the cloned session in the enter-as tab

Fixkamo-internal
Shipped
August 24, 2026 at 11:23 PM UTC
Author
kamo
Commit
3db6129

Entering an org opens a tab with window.open('', '_blank') and points it at /validate. That was cross-origin until now, so nothing was shared. It is same-origin for an org without a custom domain, and a same-origin window.open CLONES the opener's sessionStorage -- which is where the session id lives. The new tab therefore starts out holding the session for the org being LEFT. /validate overwrites it a moment later, so the window is short. It is not zero: if the one-time key has expired or the navigation fails, that tab keeps acting as the source org while presenting itself as the destination. Clearing first makes the worst case a tab with no session, which reads as signed out rather than as somebody else. Wrapped in a try: a custom-domain workspace opens cross-origin, where touching the new tab's storage throws and nothing was cloned anyway. 2880 tests pass. The 2 that fail locally are a rights-hierarchy parity check reading RoleRightType.java from the sibling Java repo, which has uncommitted edits from another session; the test is skipIf(!available) and CI checks out this repo alone, so it skips there.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing