DEV BOX

'26/11/16 UPDATE

WEB / COOKIES / FIELD NOTES

I switched to SameSite=Strict. Why do email links now look logged out?

The cookie is stored, yet a request that arrives from a link on another site does not carry Strict. Server logs from Chromium 152 show which cookies a link, a POST and a subdomain carried, then test splitting read and write cookies and a landing page, and mark where work can be lost.

Switch a session cookie to SameSite=Strict and someone who clicks a link in webmail can land on a screen that says they are not signed in. The cookie has not been deleted. It just was not sent with that one request. After reading this you can check from your server log which request carried which cookie, choose between splitting the cookie in two and adding a landing page, and spot the places in that change where users could lose work.

The examples were run on 2026-11-01 on macOS 27.0.1. The browser is the built-in browser of the Claude desktop app (Chromium 152.0.7977.167) and the server is a local one written with Node.js v24.21.0. One port, 4611, has three host names: app.localhost is the app, mail.localhost is another site standing in for webmail, and other.app.localhost is a subdomain of the app. The webmail, cookies and addresses are made-up lab values. The server uses plain HTTP on localhost, so the cookie lines below have no Secure; add it to session cookies on a real site. HTTPS was not run.

Google Chrome, Safari, Firefox, phone browsers, real webmail, desktop mail apps and the browser toolbar's reload button were not run. Links that open in a new tab could not be tested: in this built-in browser such a click stayed in the same tab and logged none with every cookie, which looks like the browser pane's own handling, so that result is not used here. If your mail links open in a new tab, check that case in your own browser.

Same address, different cookies depending on how you got there

Signing in gives three cookies that differ only in their attributes. The account page counts you as signed in only if the Strict cookie is there, which imitates an app that switched its one session cookie to Strict.

lab1116_strict=1; SameSite=Strict; Path=/; Max-Age=3600; HttpOnly
lab1116_lax=1; SameSite=Lax; Path=/; Max-Age=3600; HttpOnly
lab1116_unset=1; Path=/; Max-Age=3600; HttpOnly

For each request the server logs the Sec-Fetch-Site value and the names of the cookies that arrived, not their values. This is the log after actually clicking the link on the mail page, then clicking inside the page that opened.

Server log. Opened directly: none, with strict, lax and unset, signed in. Mail link click: cross-site with lax and unset only, please sign in. Link on the page and location.reload(): same-origin with all three, signed in. After the app's 302 the request is still cross-site with lax and unset only, please sign in.
The same /account: only the lines that arrive from the mail link lose strict and show please sign in. The line after the app's own 302 is still cross-site. In these log images, lines starting with # are notes added for this article, and log lines are shortened and folded to fit.

The red lines answer the question. The request from the mail link is cross-site and has no strict, so the app showed please sign in. Clicking a link inside that page reached the same address as same-origin, with strict included. The draft cookie standard rfc6265bis (revision 22, with no RFC number as of 2026-11-01) uses an emailed link as its example in section 8.8.2 and says Strict session cookies can confuse users.

The 302 lines are easy to miss. The mail link reached the app's /go, the server sent a 302 to /account, and the second request was still cross-site, so the Strict cookie did not come back. A script's location.reload() did carry it, as same-origin. Section 8.8.5 of the draft says a reload from the toolbar does not count as same-site if the original navigation came from another site. The automation tool could not press that button, so that case comes from the document only and was not run.

The first line, opened directly, is none and has every cookie. MDN describes this value as a user-originated operation such as typing an address or opening a bookmark. That line came from the automation tool's navigate command, though, not from real typing in an address bar. Whether a browser opened by a desktop mail app also lands here cannot be said, because it was not run. So when a report comes in, it helps to ask first which mail environment the link was clicked in.

What opens up if you drop to Lax

The cards group the log by path. A link click carries Lax; a POST does not.

DEV NOTES

Which request carried which cookie

Copied from the 2026-11-01 run log on Chromium 152

  • Link clicked on another site

    GET, cross-site

    • Strict: left out
    • Lax: sent
    • Not set: sent
  • POST form on another site

    POST, cross-site

    • Strict: left out
    • Lax: left out
    • Not set: sent at 9 s, left out at 132 s
  • fetch and img on another site

    • All three left out (fetch used credentials: 'include')
  • Subdomain of the same site

    same-site

    • All three sent on the POST form and the link
    • SameSite looks at the site, not the origin

No other browser was run. The time window for not set is behaviour the draft allows (MAY).

Requests that carried or dropped each cookie, by path. The top two cards are the difference between a link and a POST; the last card is the path even Strict does not stop.

These are the log lines behind those cards.

Server log. Mail page POST: at cookie age 9 s only unset is sent, accepted by unset; at 132 s no cookies, no session. Mail page GET form: cross-site with lax and unset, note 7 deleted. fetch and img: cross-site with no cookies. Subdomain POST: same-site with strict, lax and unset, accepted by strict.
lax was missing from the POST but present on a state-changing GET, and the subdomain's POST carried even strict. The unset cookie, with no SameSite attribute, was on the POST at 9 s and gone at 132 s.

On the blocked side, the POST form on the mail page had no lax, and fetch and img had no cookies at all. Three things are risky.

First, a GET that changes state. The lab's /notes/7/delete is a deliberately bad address that deletes on GET, and the GET form on the mail page carried lax, so it ran. MDN and OWASP also say Lax sends the cookie on top-level navigations with safe methods.

Second, subdomains. The POST from other.app.localhost was classed same-site and carried even strict. SameSite looks at the site, not the origin. MDN explains that relying on this attribute means trusting all your subdomains. If user content or outside services live on your subdomains, Strict does not stop that path either.

Third, a cookie with no SameSite attribute. unset was on the POST at a cookie age of 9 seconds and gone at 132 seconds. Section 5.6.7.2 of the draft says a browser may (MAY) make this exception, only for cookies that did not state the attribute, and gives 2 minutes or less as a reasonable age. This test measured only 9 and 132 seconds, so it does not confirm that the limit is exactly 2 minutes, and it cannot be assumed to be the same in every browser. MDN says some browsers use Lax as the default, so in a browser that does not, this cookie may go out on more requests than this log shows. Leaving the attribute out and relying on the default means taking this behaviour too.

Split into a read cookie and a write cookie

Section 8.8.2 of the draft suggests this, and MDN's CSRF page recommends it too. The cookie that decides whether to show a page is Lax; the cookie that allows state-changing requests is Strict. The server looks only at read for reading and only at write for writing.

lab1116_read=1; SameSite=Lax; Path=/; Max-Age=3600; HttpOnly
lab1116_write=1; SameSite=Strict; Path=/; Max-Age=3600; HttpOnly
Server log. v2 account page: cross-site with read only, signed in. POST on that page: same-origin with read and write, done. POST from the mail page: cross-site with no cookies, refused: no write cookie.
With split cookies the mail link opens on the read cookie, the form on that page carries the write cookie, and a direct POST from the mail page is refused.

The log shows what the split is meant to do. Arriving from the mail link, the page opened on read. Submitting that page's form carried write as well, because the request started on an app page, and it went through. A POST sent directly by the mail page had no write cookie and was refused. The two cookies are not the whole of CSRF defence. The draft strongly encourages server-side defences such as CSRF tokens alongside it, and OWASP also says to treat SameSite as an extra layer unless a deployment meets all of a narrow set of conditions.

If you cannot split the cookie, a landing page is an option. A request that arrives without the Strict cookie gets a short page whose script, location.replace('/landing?retried=1'), opens it again. An app page starts that navigation, so the cookie is sent. The retried flag stops an endless loop. In the log below the first two lines are signed in and the last two signed out, where it re-navigates once and then stops.

GET /landing cross-site [lax unset] => script re-navigates
GET /landing?retried=1 same-origin [strict lax unset] => signed in
GET /landing cross-site [] => script re-navigates
GET /landing?retried=1 same-origin [] => please sign in

Four places where work can be lost

This log groups four cases where shipping the fix can cost users their work or remove a protection.

Server log. renav-delete: cross-site with lax and unset, then script moves to notes/7/delete, same-origin with strict, lax and unset, note 7 deleted. account-clears: cross-site with lax and unset, cookies cleared; then account opened directly has no cookies, please sign in. A v2 POST from an old session: same-origin with read only, refused: no write cookie. The migrate cookie goes out with the mail link while stored as Lax and is gone after it is set again as Strict.
A landing page in front of a delete carries strict and the delete runs, a guard that clears cookies causes a real logout, and a submit from an old session with no write cookie is refused. A cookie stored as Lax kept going out with the mail link until a new Set-Cookie arrived.

Use a landing page only for read-only pages. In the first group of the log, a landing page in front of a delete address carried strict as same-origin, so a single link on another site ran the delete. Section 8.8.5 of the draft also warns about care with reloads the user did not start.

Do not treat a missing cookie as a logout. In the second group the guard cleared the cookies on a request with no Strict cookie, and the next direct request had no cookies at all. One mail link became a real logout. In a real app, a request saving something written in another tab would probably arrive without a session too. That other-tab case was not run.

Look after existing sessions before you ship the split. The third group is an old session holding only read, submitting a form inside the app, and it was refused. This lab only refuses and keeps no input, so in a real app the text being written could disappear. Issue the write cookie on the next request first, show a screen that keeps the input when refusing, and only then turn refusal on. Remove that issuing path once the migration is done. The answer section 8.8.2 of the draft gives for a missing write cookie is re-authentication. This sequence is the author's suggestion, and only the refused line was actually run. Some apps also rely on cookies for a cross-site POST coming back from a payment or login provider. Section 8.8.6 of the draft gives a login flow as an example. That path is not in this lab, so test it yourself.

Changing the attribute in a release does not change cookies already stored. In the last group, migrate went out with the mail link while stored as Lax and dropped out only after a new Set-Cookie made it Strict. So the symptom does not appear for everyone right after a release; it starts with people who receive the cookie again. Rolling back should work the same way, but this lab ran only the change from Lax to Strict.

Before changing SameSite, log the cookie names and Sec-Fetch-Site, and click once each through a link on another site, a POST from another site and a form inside the app. You do not need to log the values. Browsers send this header only to potentially trustworthy URLs such as HTTPS or localhost, so a plain-HTTP staging host will log nothing for it. Which line loses which cookie gives you the basis for deciding which cookies should be Strict and which Lax.

THE END
RSS feedBack to the library
COMMENTS BOX

Add your perspective.

Share a question, another approach, or something you have tried.

Newest first

Checking sign-in…

Loading comments…