Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SameSite attribute to Cookie #7798

Closed
chlily1 opened this issue Nov 19, 2019 · 6 comments
Closed

Add SameSite attribute to Cookie #7798

chlily1 opened this issue Nov 19, 2019 · 6 comments

Comments

@chlily1
Copy link

chlily1 commented Nov 19, 2019

🚀 Feature Proposal

SameSite attribute on Cookie object

Motivation

The Cookie.Builder object does not accommodate a SameSite field, described here in the spec.

This makes it impossible to specify the SameSite field of a cookie, which can either be None, Lax, or Strict. This field can be specified in the Set-Cookie HTTP header, so the Cookie object should also support it.

Example

Cookie cookie = new Cookie.Builder("name", "value")
    .sameSite("lax")
    .build();
@jmakr0
Copy link

jmakr0 commented Nov 22, 2019

Since Chrome, Firefox, Edge and consequently the others apply SameSite by default in the beginning of 2020, it would be much appreciated indeed.

@gjyalpha
Copy link

FYI. ChromeDriver has implemented the support of Cookie's SameSite attribute in https://bugs.chromium.org/p/chromedriver/issues/detail?id=3264

@adamklinkosz
Copy link

Any new on this one? Browsers will start to require this attribute to be set and we need to be able to test whether it is present.

@gjyalpha
Copy link

gjyalpha commented May 1, 2020

Ah, yes.

  1. The WebDriver spec switched the JSON key from "samesite" to "sameSite". My previous PR followed the previous "samesite". Now we need to change it to "sameSite". I can try to make another PR to fix this.

  2. Another minor issue is that now the samesite attribute accepts a string value. And in general, browser should treat these values as case insensitive values. But ChromeDriver uses Chrome DevTools Protocol (CDP) behind the scene, and CDP treats the value as case sensitive values. So we might need to consider add some normalization logic in Cookie.java to make user's life slightly easier.

@gjyalpha
Copy link

gjyalpha commented May 1, 2020

Fixing the JSON key in #8265

@AutomatedTester
Copy link
Member

I believe this is all fixed in all clients so closing

@diemol diemol closed this as completed Mar 10, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Sep 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants