- From: Xyan Bhatnagar <xyanb@apple.com>
- Date: Wed, 01 Jul 2026 13:54:49 -0700
- To: Lily Chen <chlily@chromium.org>
- Cc: Mike West <mkwst@google.com>, Daniel Veditz <dveditz@mozilla.com>, HTTP Working Group <ietf-http-wg@w3.org>
- Message-id: <3A0244A2-8E5C-41C7-B4B2-FF9AF188248C@apple.com>
In my head, there is a significant difference between a cookie like `foo` and `=foo`. Both are considered nameless, but I’m wondering if they should be treated differently. Case A: `foo` (ambiguous cookie) This is treated by PHP, Safari and Firefox as a valueless cookie with name `foo`. Chrome treats it as a nameless cookie with value `foo`. There is an open-ended question here of how it is interpreted, which we should figure out together. On the one hand, I see the merit of keeping these as nameless cookies, such that one entry in the cookie jar is where they all end up, to avoid jar pollution. On the other hand, I’m also concerned about subtle vulnerabilities from treating them as nameless cookies. As described in https://github.com/httpwg/http-extensions/issues/2229 (section called “Client/Server confusion: cookie tossing”), it is possible for a malicious actor to use a nameless cookie to override a `__Host-` cookie in specific backends like PHP. I see that this kind of vulnerability was already discovered in Chromium (https://issues.chromium.org/issues/40060319) and corrected by explicitly rejecting `__Host-` prefixes in nameless cookies. Case B: `=foo` (intentional nameless cookie) This cookie is rejected by both Safari and Firefox. Chrome treats it as a nameless cookie with value `foo`. According to https://github.com/httpwg/http-extensions/issues/2229, PHP would have also rejected such a cookie, if it were sent as `Cookie: =foo`. That doesn't happen because of the RFC spec which says the `=` should be omitted from a nameless cookie. Here, the unambiguous intention of the server is to store a nameless cookie. I would be surprised if there is an intentional use of this kind of nameless cookie, but the internet is a large place and I’ve not seen all of it :) It would be great to have metrics on how common this specific case is, to better inform our decisions. > On Jul 1, 2026, at 10:53 AM, Lily Chen <chlily@chromium.org> wrote: > > It seems this behavior has diverged somewhat. I wrote down what I observed from Wpt.fyi runs recently in this thread: https://groups.google.com/a/chromium.org/g/blink-dev/c/SQUdQBMJqDk/m/Zoa60pYfCwAJ?utm_medium=email&utm_source=footer > > I'm supportive of eliminating nameless cookies, but share your concerns Mike. > > In particular, the possible world in which "Set-Cookie: foo" is consistently parsed into a valueless cookie named foo (rather than a nameless cookie holding value foo, as Chromium does currently) seems slightly problematic to me from the perspective of leaving behind many such cookies littering the domain's cookie jar, which the server may not understand how to clear. The fact that there is only one nameless cookie that is overwritten by subsequent sets seems convenient here. > > Lily > > On Wed, Jul 1, 2026, 1:40 PM Mike West <mkwst@google.com <mailto:mkwst@google.com>> wrote: >> Looking briefly at Chrome's telemetry over the past ~month, we see ~0.02% of cookie parsing actions resulting in a nameless cookie: of those, about half are known tokens (`HttpOnly`, `Secure`, etc) or explicitly nameless values (e.g. `=value`). So, ~0.01% of cookie parsing actions aren't something that can be easily categorized as mistakes. >> >> I'm enthusiastic about ending support for nameless cookies from a philosophical perspective. I'm less enthusiastic about doing so from a practical perspective, as 0.01% of all cookie parsing is still a pretty high level of potential breakage if we changed the behavior. +Lily Chen <mailto:chlily@chromium.org> who made some changes in this space relatively recently, as they might have a more nuanced opinion. :) >> >> For clarity, though: what is the behavior Safari and Firefox have aligned on for `Set-Cookie: foo`? Is it rejected entirely? Do you set a cookie with an empty value named `foo`? >> >> -mike >> >> >> On Sat, Jun 27, 2026 at 5:29 AM Daniel Veditz <dveditz@mozilla.com <mailto:dveditz@mozilla.com>> wrote: >>> On Thu, Jun 25, 2026 at 1:38 PM Xyan Bhatnagar <xyanb@apple.com <mailto:xyanb@apple.com>> wrote: >>>> Safari has rejected nameless cookies for a while now. What are the observed use-cases of nameless cookies? Does anyone know of servers that send out such cookies and the motivations for doing so? >>> >>> The main issue faced by the original rfc6265 was that sometimes servers sent `Set-Cookie: foo` instead of a "foo=value". If a browser didn't return it, some sites would break so the RFC had to define consistent behavior. But is plain "foo" a name without a value, or a value without a name? On the server side it wouldn't matter what the browser thinks as long as it sends the cookie back, but the difference does have detectable side-effects. IMHO "nameless value" is a strange unintuitive choice—surely the servers that use them don't think that's what it is! They probably use it as a boolean attribute. Or, it turns out, sometimes the malformed cookie was a mistake. I think part of the reasoning behind nameless cookies was that the folks at the time wanted to discourage cookies that weren't name=value, but since they couldn't stop supporting them for web-compat reasons, by considering them as nameless values sites could only use ONE of them. >>> >>> Some of the above is speculation, but I do remember there were sites that broke if you rejected cookies that weren't name=value pairs, and some reason to not do the obvious and treat them as valueless names as Safari does. >>> >>> -Dan Veditz
Received on Wednesday, 1 July 2026 20:55:30 UTC