Skip to content

Conversation

geoffyoungs
Copy link

Currently if a site specifies SameSite=None etc in the set-cookie header, it will be lost when HTTP::Cookie.parse parses it.

This PR adds support for parsing, preserving and restoring, via HTTP::Cookie#set_cookie_value the SameSite=X attribute.

It also respects the __Secure- and __Host- prefixes and rejects cookies that violate the spec.

Sources:

Currently if a site specifies SameSite=None in the cookie, it will be
lost when HTTP::Cookie.parse parses it.

This PR adds support for parsing, preserving and restoring, via
HTTP::Cookie#set_cookie_value the SameSite=X attribute.

It also respects the __Secure- and __Host- prefixes and rejects cookies
that violate the spec.

Sources:
 - https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#samesite_attribute
 - https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#cookie_prefixes
 - https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-cookie-prefixes
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.

1 participant