New issue
Advanced search Search tips

Issue 635882 link

Starred by 4 users

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2018
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac , Fuchsia
Pri: 2
Type: Bug



Sign in to add a comment

When setting a cookie with "SameSite" (without lax or strict) the cookie is not set.

Reported by scott.he...@gmail.com, Aug 9 2016

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36

Steps to reproduce the problem:
1. Clear any cookies for the site in question.
2. Create a cookie. Set-Cookie: sess=123; path=/; SameSite
3. Visit the page and observe cookies.

What is the expected behavior?
The cookie is set with the SameSite attribute set to Strict.

What went wrong?
The cookie was not set.

Did this work before? N/A 

Chrome version: 52.0.2743.82  Channel: n/a
OS Version: 10.0
Flash Version: Shockwave Flash 22.0 r0

Section 3.1 of the spec states that "SameSite" is a valid value: https://tools.ietf.org/html/draft-west-first-party-cookies-07#section-3.1

Section 4.1 also states:

2.  Let "enforcement" be "Lax" if "cookie-av"'s "attribute-value" is
       a case-insensitive match for "Lax", and "Strict" otherwise.

https://tools.ietf.org/html/draft-west-first-party-cookies-07#section-4.1
 
Components: Internals>Network>Cookies
Labels: -Type-Bug-Security -Restrict-View-SecurityTeam Type-Bug
Owner: mkwst@chromium.org
Status: Assigned (was: Unconfirmed)
mkwst, mind taking a look?
See  issue 617569 

Comment 3 Deleted

Please ignore my previous comment (now deleted).

While I think the spec could be more clear, where section 4.1 starts by saying:

    If [the] "attribute-value" is not a case-sensitive match
    for "Strict" or "Lax", ignore the "cookie-av".

It does not mean ignore the cookie attribute SameSite, it's saying that the *attribute value* should be ignored, the SameSite attribute itself should still be respected; where Step 2 then goes on to say that it should default to Strict.

That said, I would still prefer every website to explicitly state the level of enforcement that they want.
I kind of like the idea of a default, and that default being the more strict option too!

It also makes the cookie a littler smaller/tidier ;-)
True, I agree that more secure defaults are a good thing.

But when you are setting soemething that can break navigation between websites (destination will not think you are logged in), then I'd rather the developers be explicit :-)
Summary: When setting a cookie with "SameSite" (without lax or strict) the cookie is not set. (was: When setting a cookie with "SameSite" the cookie is not set.)
Test page: https://bayden.com/test/cookie/BareSameSiteCookie.aspx

I filed https://github.com/httpwg/http-extensions/issues/389 on the ambiguity in the spec. I don't think Chrome matches any reasonable interpretation of the latest spec; at worst we should ignore the SameSite attribute, but not fail to set the cookie.

bool ParsedCookie::IsValid() const {
  return !pairs_.empty() && IsSameSiteAttributeValid();  <-- This seems wrong.
}

bool ParsedCookie::IsSameSiteAttributeValid() const {
  return same_site_index_ == 0 || SameSite() != CookieSameSite::DEFAULT_MODE;
}

Hrmph. It looks like the https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00 draft is outdated vs. https://github.com/httpwg/http-extensions/edit/master/draft-ietf-httpbis-cookie-same-site.md. The latter no longer allows a bare "SameSite" token, and it calls for the cookie to be dropped in the event that the samesite-value isn't either "strict" or "lax".

That would imply this bug should be "Won't Fixed".
The specification has changed[1], and now says that the attribute should be ignored rather than ignoring the cookie.

The CL in #8 treats a missing/invalid attribute as "strict" which doesn't match the new version of the spec.

[1] https://github.com/httpwg/http-extensions/commit/c303325cd14b3fbbda85b22f2bdee622d922c5be
Owner: elawrence@chromium.org
Status: Started (was: Assigned)
https://chromium-review.googlesource.com/c/chromium/src/+/1007866
Project Member

Comment 12 by bugdroid1@chromium.org, Apr 12 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/5fbb75e93162093522879e707a13295b7452ef06

commit 5fbb75e93162093522879e707a13295b7452ef06
Author: Eric Lawrence <elawrence@chromium.org>
Date: Thu Apr 12 20:39:53 2018

Update SameSite cookie handling to match specification

The SameSite cookie specification calls for ignoring the SameSite
attribute if the value is empty or unrecognized. Previously, Chrome
would refuse to create a cookie with an empty or unrecognized
SameSite attribute value.

Bug:  635882 
Test: net_unittests
Change-Id: I429058d6f97db107307f9affb99bf96f4e175a2a
Reviewed-on: https://chromium-review.googlesource.com/1007866
Commit-Queue: Eric Lawrence <elawrence@chromium.org>
Reviewed-by: Mike West <mkwst@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550344}
[modify] https://crrev.com/5fbb75e93162093522879e707a13295b7452ef06/net/cookies/canonical_cookie_unittest.cc
[modify] https://crrev.com/5fbb75e93162093522879e707a13295b7452ef06/net/cookies/cookie_constants.h
[modify] https://crrev.com/5fbb75e93162093522879e707a13295b7452ef06/net/cookies/parsed_cookie.cc
[modify] https://crrev.com/5fbb75e93162093522879e707a13295b7452ef06/net/cookies/parsed_cookie.h
[modify] https://crrev.com/5fbb75e93162093522879e707a13295b7452ef06/net/cookies/parsed_cookie_unittest.cc

Labels: M-67 OS-Android OS-Chrome OS-Fuchsia OS-Linux OS-Mac
Status: Fixed (was: Started)
Fixed in 67.0.3396.0.
Project Member

Comment 14 by bugdroid1@chromium.org, Apr 17 2018

Labels: merge-merged-testbranch
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/5fbb75e93162093522879e707a13295b7452ef06

commit 5fbb75e93162093522879e707a13295b7452ef06
Author: Eric Lawrence <elawrence@chromium.org>
Date: Thu Apr 12 20:39:53 2018

Update SameSite cookie handling to match specification

The SameSite cookie specification calls for ignoring the SameSite
attribute if the value is empty or unrecognized. Previously, Chrome
would refuse to create a cookie with an empty or unrecognized
SameSite attribute value.

Bug:  635882 
Test: net_unittests
Change-Id: I429058d6f97db107307f9affb99bf96f4e175a2a
Reviewed-on: https://chromium-review.googlesource.com/1007866
Commit-Queue: Eric Lawrence <elawrence@chromium.org>
Reviewed-by: Mike West <mkwst@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550344}
[modify] https://crrev.com/5fbb75e93162093522879e707a13295b7452ef06/net/cookies/canonical_cookie_unittest.cc
[modify] https://crrev.com/5fbb75e93162093522879e707a13295b7452ef06/net/cookies/cookie_constants.h
[modify] https://crrev.com/5fbb75e93162093522879e707a13295b7452ef06/net/cookies/parsed_cookie.cc
[modify] https://crrev.com/5fbb75e93162093522879e707a13295b7452ef06/net/cookies/parsed_cookie.h
[modify] https://crrev.com/5fbb75e93162093522879e707a13295b7452ef06/net/cookies/parsed_cookie_unittest.cc

Sign in to add a comment