Skip to content

RFC 6265bis compliance for the cookie implementation - #869

Open
arturobernalg wants to merge 1 commit into
apache:masterfrom
arturobernalg:cookie-name-prefixes
Open

RFC 6265bis compliance for the cookie implementation#869
arturobernalg wants to merge 1 commit into
apache:masterfrom
arturobernalg:cookie-name-prefixes

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

Enforces the __Secure- and __Host- cookie name prefixes, adds the SameSite attribute with the SameSite=None requires Secure rule, includes the host-only flag in cookie identity, applies the 4096-byte cookie and 1024-byte attribute size limits and the 400-day maximum lifetime, supports nameless cookies in both parsing and serialization, and prevents a non-secure connection from overwriting a stored secure cookie.

@arturobernalg
arturobernalg marked this pull request as ready for review August 13, 2026 07:24
@arturobernalg
arturobernalg requested a review from ok2c August 13, 2026 07:24
@ok2c

ok2c commented Aug 16, 2026

Copy link
Copy Markdown
Member

@arturobernalg RFC 6265bis is still a draft, it is not? What is so important about this feature that we need to rush it and implement a draft RFC which has not been accepted as standard yet?

@arturobernalg

Copy link
Copy Markdown
Member Author

@arturobernalg RFC 6265bis is still a draft, it is not? What is so important about this feature that we need to rush it and implement a draft RFC which has not been accepted as standard yet?

@ok2c
You're right, it's still a draft — but the __Host-/__Secure- prefix and SameSite bits it covers are already universal, interoperable browser behaviour, and the prefix checks are a real acceptance/security gap in our cookie store today. Happy to scope it to just those stable parts and mark it @experimental, or hold it until 6265bis is published

@ok2c

ok2c commented Aug 17, 2026

Copy link
Copy Markdown
Member

@arturobernalg I honestly have no idea how much those new attributes are being used / relied upon in everyday life. I have an impression HTTP cookies are getting used less and less. I was even going to propose to disable automatic cookie handling by default.

Anyway, I leave it up to you to make a call here. If you resolve the conflicts I will take another look at the parsing code.

Enforces the __Secure- and __Host- cookie name prefixes, adds the SameSite
attribute with the SameSite=None requires Secure rule, includes the host-only
flag in cookie identity, applies the 4096-byte cookie and 1024-byte attribute
size limits and the 400-day maximum lifetime, supports nameless cookies in both
parsing and serialization, and prevents a non-secure connection from overwriting
a stored secure cookie.
final String name = tokenParser.parseToken(buffer, cursor, TOKEN_DELIMS);
if (name.isEmpty()) {
return null;
final String token = tokenParser.parseToken(buffer, cursor, TOKEN_DELIMS);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@arturobernalg Is this more complex parsing logic something that 6265bis mandates?

I am not going to object to these changes as long as you confirm you know what you are doing.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@ok2c
Yes. The more permissive parsing is required by the 6265bis user-agent algorithm.
In particular, a Set-Cookie value without = is parsed as a nameless cookie, and the UA parser is intentionally more permissive than the server grammar.

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