Skip to content

Apply SameSite=Lax exception only on safe methods - #3335

Open
nikneym wants to merge 1 commit into
mainfrom
nikneym/lax-exception-RFC6265bis
Open

Apply SameSite=Lax exception only on safe methods#3335
nikneym wants to merge 1 commit into
mainfrom
nikneym/lax-exception-RFC6265bis

Conversation

@nikneym

@nikneym nikneym commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

On top of #3293.

@krichprollsch
krichprollsch changed the base branch from main to nikneym/samesite-strict-bypass August 28, 2026 15:01
@karlseguin
karlseguin force-pushed the nikneym/samesite-strict-bypass branch from be441b5 to 07198b7 Compare September 1, 2026 23:28
Base automatically changed from nikneym/samesite-strict-bypass to main September 1, 2026 23:54
@nikneym
nikneym force-pushed the nikneym/lax-exception-RFC6265bis branch from f368d1f to 5f8972d Compare September 2, 2026 13:14
@nikneym
nikneym requested a review from karlseguin September 2, 2026 13:15

@karlseguin karlseguin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread src/browser/webapi/storage/Cookie.zig Outdated
@nikneym

nikneym commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Any thoughts on re-sync.nl/en/blog/samesite-lax-cookie-bypass ?

Interesting find & article... Turns out there's also a section that touch this in RFC6265bis:

5.6.7.2. "Lax-Allowing-Unsafe" enforcement

As discussed in Section 8.8.6, compatibility concerns may necessitate
the use of a "Lax-allowing-unsafe" enforcement mode that allows
cookies to be sent with a cross-site HTTP request if and only if it
is a top-level request, regardless of request method. That is, the
"Lax-allowing-unsafe" enforcement mode waives the requirement for the
HTTP request's method to be "safe" in the SameSite enforcement step
of the retrieval algorithm in Section 5.8.3. (All cookies,
regardless of SameSite enforcement mode, may be set for top-level
navigations, regardless of HTTP request method, as specified in
Section 5.7.)

"Lax-allowing-unsafe" is not a distinct value of the SameSite
attribute. Rather, user agents MAY apply "Lax-allowing-unsafe"
enforcement only to cookies that did not explicitly specify a
SameSite attribute (i.e., those whose same-site-flag was set to
"Default" by default). To limit the scope of this compatibility
mode, user agents which apply "Lax-allowing-unsafe" enforcement
SHOULD restrict the enforcement to cookies which were created
recently. Deployment experience has shown a cookie age of 2 minutes
or less to be a reasonable limit.

@nikneym
nikneym marked this pull request as draft September 4, 2026 15:33
@nikneym
nikneym force-pushed the nikneym/lax-exception-RFC6265bis branch 2 times, most recently from 3fb2614 to cee0296 Compare September 8, 2026 12:09
@nikneym

nikneym commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

This currently conflicts w/ #3448; since both touch SameSite=Lax movement, I'm working on a change that cover both.

@nikneym
nikneym force-pushed the nikneym/lax-exception-RFC6265bis branch from cee0296 to 58193cc Compare September 9, 2026 16:20
Specifically to distinguish cross-site iframe navigation from top-level navigation, this PR reworks how `SameSite=Lax` moved. Since we're not checking if its a navigation alone now, the field for it is also renamed to `lax_allowed`.
@nikneym
nikneym force-pushed the nikneym/lax-exception-RFC6265bis branch from 58193cc to 380bdcf Compare September 9, 2026 16:43
@nikneym
nikneym marked this pull request as ready for review September 9, 2026 16:44
@nikneym

nikneym commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

This now also includes a solution for what #3448 trying to fix.

@nikneym
nikneym requested a review from karlseguin September 10, 2026 10:00
@karlseguin

Copy link
Copy Markdown
Collaborator

LGTM, but I think this is worth tests in ../demo/ (or as an html test in this project if that works). There's 1 unit test for the Cookie.Jar, but the feature requires all the layers to do their part, which isn't tested anywhere.

@nikneym

nikneym commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

Agreed, will add this through demo.

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.

2 participants