Repository navigation
fix(liveview): SameSite=None on live cookie so the cross-site iframe sends it - #408
Merged
Merged
Conversation
…s it The live-auth cookie was SameSite=Strict. The iframe's origin is localhost:<live> but it's embedded by the dashboard at 127.0.0.1:<dash>; browsers treat those as different sites, so the framed request is cross-site and a Strict cookie is never sent. The 302 set the cookie but the follow-up framed request omitted it -> 403 -> white screen. The verify-live-view endpoint missed this because it loads the URL top-level (first-party), where Strict works -> reported rendered:true while the browser showed white. Use SameSite=None; Secure (the only cookie sent cross-site; browsers accept Secure over http://localhost as a loopback exception). No isolation change: the token only authorizes framing the sandbox app, never dashboard access; still HttpOnly + host-only loopback. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
Live View showed a white screen even after the frame-ancestors CSP fix (#407). Root cause is a second cross-origin problem underneath the CSP one: the live-auth cookie was
SameSite=Strict.The iframe's origin is
localhost:<livePort>but it is embedded by the dashboard at127.0.0.1:<dashPort>. Browsers treatlocalhostand127.0.0.1as different sites, so every request the iframe makes is cross-site (third-party). AStrict/Laxcookie is never sent there:…?__live_token=X→ server 302s and sets theStrictcookie.verify-live-viewnever caught this: it loads the URL top-level (first-party), whereStrictworks fine — so it reportedrendered: truewhile the browser stayed white.The fix
SameSite=None; Secure— the only cookie sent in a cross-site context. Browsers acceptSecurecookies overhttp://localhostas a loopback exception, so it works on plain HTTP.Not a security regression
SameSitecontrols when the cookie is sent, not who can read it. The token is single-purpose (authorizes framing the sandbox app, zero dashboard access — dashboard uses a separatecorral_dash_tokenon127.0.0.1, never sent tolocalhost). StillHttpOnly(framed app JS can't read it) and host-only loopback. Framing remains gated by the CSPframe-ancestorsallowlist (loopback dashboard origins only). The untrusted-app → dashboard barrier is unchanged.Test
TestRequireLiveAuthnow assertsSameSite=None; Secureso this can't regress.🤖 Generated with Claude Code