Skip to content

fix(runtime): ask marimo for SameSite=None when the kernel is framed cross-site - #329

Draft
0x0f0f0f wants to merge 1 commit into
marimo-team:mainfrom
0x0f0f0f:fix/kernel-cookie-samesite-cross-site
Draft

0x0f0f0f wants to merge 1 commit into
marimo-team:mainfrom
0x0f0f0f:fix/kernel-cookie-samesite-cross-site

Conversation

@0x0f0f0f

Copy link
Copy Markdown
Contributor

This pull request was authored by a coding agent.

Closes #328.

Under subdomain exposure the kernel is framed cross-site, so marimo's session cookie is third-party. Firefox drops it by default, the token exchange never persists, and marimo 303s to /auth/login — a page it serves with X-Frame-Options: DENY. Permanently blank frame.

Where the fix goes: the exposure is what knows the kernel is cross-site, so ExposurePreparation carries it the same way it already carries baseUrl for proxy. SubdomainExposure.prepare() asks for SameSite=None; the provisioner passes MARIMO_SESSION_COOKIE_SAMESITE. proxy is same-origin and asks for nothing.

Blocked on the matching marimo change that reads the riable. Older kernels ignore it and keep lax, so this is safe on a mixed fleet of sandbox images.

…cross-site

Under `subdomain` exposure the kernel is served from an isolated domain and framed
by the app, so marimo's session cookie is a THIRD-PARTY cookie. Browsers that
restrict third-party cookies (Firefox by default, Safari) drop it, so the token
exchange never persists, the next request is unauthenticated, and marimo answers
`303 -> /auth/login` — a page it serves with `X-Frame-Options: DENY`. The frame is
then permanently blank with no recoverable state. Closes marimo-team#328.

The exposure is what knows the kernel is cross-site, so `ExposurePreparation`
carries the requirement the same way it already carries `baseUrl` for `proxy`:
`SubdomainExposure.prepare()` asks for `SameSite=None`, and the provisioner passes
it to the launch as `MARIMO_SESSION_COOKIE_SAMESITE`. `proxy` is same-origin and
asks for nothing.

The variable is prefixed onto the whole start command rather than inside
`marimoCommand`, which is nested under `uv run` — `uv run` passes its environment
through. Jobs serve no browser and are left alone.

Needs the matching marimo change that reads the variable; older kernels ignore it
and keep the `lax` default, so this is safe across a mixed fleet of images.
@vercel

vercel Bot commented Sep 12, 2026

Copy link
Copy Markdown

@0x0f0f0f-agents is attempting to deploy a commit to the marimo Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

github-actions Bot commented Sep 12, 2026

Copy link
Copy Markdown

Caution

Pull Request opener is not an author or co-author of any commit in this PR.

This check is blocked to guard against commits being submitted under a trusted identity the submitter does not control. If this PR is a legitimate cherry-pick, release-engineering submission, or mailing-list-style patch delivery, the repository maintainer can opt out of this check by setting require-opener-as-author: 'false' on the CLA-assistant step in the repository's workflow.

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@0x0f0f0f-agents

Copy link
Copy Markdown

I have read the CLA Document and I hereby sign the CLA

@mscolnick

mscolnick commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Browsers can still block iframed cookies, even if SameSite=None. I will look into a solution and release

@mscolnick

Copy link
Copy Markdown
Contributor

I am going to make this configurable (default off, like before). Generally, most sandbox providers can either provide their own ingress auth or provide some security through the entropy of the URL.

PR here: #330

Cookies as-is won't work well (safari and firefox still may block), but I will look to add support for Cookies Having Independent Partitioned State (CHIPS): https://developer.mozilla.org/en-US/docs/Web/Privacy/Guides/Third-party_cookies/Partitioned_cookies

@mscolnick

Copy link
Copy Markdown
Contributor

@0x0f0f0f, ive released 0.4.2 that should be fixed. and ill make some more changes related to this in the next release

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]: 0.4.1 kernel auth cannot complete under subdomain exposure when third-party cookies are blocked

3 participants