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

Cookie security attributes are going to mandated by Google Chrome #4247

Closed
joakime opened this issue Oct 28, 2019 · 7 comments
Closed

Cookie security attributes are going to mandated by Google Chrome #4247

joakime opened this issue Oct 28, 2019 · 7 comments
Assignees
Labels
Specification For all industry Specifications (IETF / Servlet / etc)

Comments

@joakime
Copy link
Contributor

joakime commented Oct 28, 2019

See https://blog.chromium.org/2019/10/developers-get-ready-for-new.html

Also the feedback at #3040 (comment)

We need to have a solution for the following:

  • Web Apps using the Servlet Cookie API.
  • Session Cookies created by Jetty.
  • Http Client Cookie usage / behaviors?
@joakime
Copy link
Contributor Author

joakime commented Oct 28, 2019

For Session Cookies, we need to support a configuration for the SameSite attribute.

  • Not Present
  • SameSite=None
  • SameSite=Lax
  • SameSite=Strict

@joakime joakime added the Specification For all industry Specifications (IETF / Servlet / etc) label Oct 28, 2019
@joakime joakime added this to To do in Jetty 9.4.23 via automation Oct 30, 2019
@blop
Copy link

blop commented Nov 4, 2019

Work is being done also on the servlet-api jakartaee/servlet#175

gregw added a commit that referenced this issue Nov 5, 2019
Allows sameSite cookie settings to be configured in SessionCookieConfig comments

Signed-off-by: Greg Wilkins <gregw@webtide.com>
gregw added a commit that referenced this issue Nov 5, 2019
Use non versioned cookie

Signed-off-by: Greg Wilkins <gregw@webtide.com>
gregw added a commit that referenced this issue Nov 5, 2019
Added test and fixed getCommentWithAttributes

Signed-off-by: Greg Wilkins <gregw@webtide.com>
@joakime
Copy link
Contributor Author

joakime commented Nov 5, 2019

Opened PR #4271

joakime added a commit that referenced this issue Nov 12, 2019
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
gregw added a commit that referenced this issue Nov 13, 2019
While it may be best practise to always use Secure cookies when SameSite is None, there is nothing in the RFC that mandates it and thus I don't believe we should prevent such a configuration.  If browsers enforce this, then users will find out soon enough... and if browsers change, then we are not required to do a new release to match.

Signed-off-by: Greg Wilkins <gregw@webtide.com>
gregw added a commit that referenced this issue Nov 13, 2019
For cookie comments with multiple SameSite attributes, the most strict
value is used. So `Strict` has precedence over `Lax` which has
precedence over `None`.

Signed-off-by: Greg Wilkins <gregw@webtide.com>
@joakime joakime moved this from To do to In progress in Jetty 9.4.23 Nov 13, 2019
gregw added a commit that referenced this issue Nov 14, 2019
* Issue #4247 SameSite Session Cookie

Allows sameSite cookie settings to be configured in SessionCookieConfig comments

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* Issue #4247 SameSite Session Cookies

Use non versioned cookie

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* Issue #4247 SameSite Session Cookies

Added test and fixed getCommentWithAttributes

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* Issue #4247 - Updating unit tests for HttpCookie

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>

* Issue #4247 SameSite Session Cookie

While it may be best practise to always use Secure cookies when SameSite is None, there is nothing in the RFC that mandates it and thus I don't believe we should prevent such a configuration.  If browsers enforce this, then users will find out soon enough... and if browsers change, then we are not required to do a new release to match.

Signed-off-by: Greg Wilkins <gregw@webtide.com>

* Issue #4247 SameSite Session Cookie

For cookie comments with multiple SameSite attributes, the most strict
value is used. So `Strict` has precedence over `Lax` which has
precedence over `None`.

Signed-off-by: Greg Wilkins <gregw@webtide.com>
@gregw gregw closed this as completed Nov 14, 2019
Jetty 9.4.23 automation moved this from In progress to Done Nov 14, 2019
@gregw
Copy link
Contributor

gregw commented Nov 19, 2019

Note that to use sameSite cookies for the session cookie, you can activate using web.xml (and STRICT/LAX/NONE in the comment):

  <session-config>
    <cookie-config>
      <comment>__SAME_SITE_STRICT__</comment>
    </cookie-config>
  </session-config>

@gregw
Copy link
Contributor

gregw commented Jan 21, 2020

I think we need to do more on this issue. Considering that Chrome will soon ignore cookies without Same-Site, then it is not sufficient just to allow applications to specify Same-Site if they wish. We need the ability to add the attribute to cookies created by existing code - ie the container needs to be able to set a default other than null

@gregw
Copy link
Contributor

gregw commented Jan 21, 2020

See also jakartaee/servlet#271

janbartel added a commit that referenced this issue Jan 23, 2020
Signed-off-by: Jan Bartel <janb@webtide.com>
@janbartel janbartel added this to To do in Jetty 9.4.27 via automation Jan 23, 2020
@janbartel janbartel moved this from To do to In progress in Jetty 9.4.27 Jan 23, 2020
janbartel added a commit that referenced this issue Jan 29, 2020
Signed-off-by: Jan Bartel <janb@webtide.com>
janbartel added a commit that referenced this issue Jan 29, 2020
* Issue #4247 use context default for samesite cookie attribute

Signed-off-by: Jan Bartel <janb@webtide.com>
janbartel added a commit that referenced this issue Jan 29, 2020
* Issue #4247 use context default for samesite cookie attribute

Signed-off-by: Jan Bartel <janb@webtide.com>
@janbartel
Copy link
Contributor

The samesite attribute can now be set via a context default value. Thus, the samesite attribute will be present if it is either set explicitly, or there is a default value set for the context. According to the documentation links provided on this issue, chrome will use a default value of LAX if no samesite value is present in a cookie.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Specification For all industry Specifications (IETF / Servlet / etc)
Projects
No open projects
Jetty 9.4.23
  
Done
Jetty 9.4.27
  
Done
Development

No branches or pull requests

4 participants