Obsolete RFCs and obsolete Cookie Path checking comments

The other day I was reading Firefox’s CookieService.cpp to figure out how Firefox determines its maximum cookie size (more on that one day, maybe) when the following comment (from 2002, according to blame) caught my eye:

The following test is part of …


This content originally appeared on Mike Taylr Dot Com Web Log and was authored by Mike Taylor

The other day I was reading Firefox’s CookieService.cpp to figure out how Firefox determines its maximum cookie size (more on that one day, maybe) when the following comment (from 2002, according to blame) caught my eye:

The following test is part of the RFC2109 spec.  Loosely speaking, it says that a site cannot set a cookie for a path that it is not on.  See bug 155083.  However this patch broke several sites -- nordea (bug 155768) and citibank (bug 156725).  So this test has been disabled, unless we can evangelize these sites.

Note 1: Anything having to do with broken websites is wont to catch my attention, especially olde bugs (let’s face it, in 2002 the internet was basically the High Middle Ages. Like yeah, we were killing it with the technological innovation on top of windmills and we’re getting pretty good at farming and what not, but it’s still the Middle Ages compared to today and kind of sucked).

Note 2: The two sites referenced in the Firefox comment are banks (see 155768 and 156725). And one of the axioms of web compatibility is that if you break a bank with some cool new API or non-security bug fix, game over, it’s getting reverted. And I’m pretty sure you can’t legally create test accounts for banks to run tests against and Silk Road got taken down by the feds.

But at the time, the now obsolete rfc2019 had this to say about cookies Path attributes:

To prevent possible security or privacy violations, a user agent rejects a cookie (shall not store its information) if any of the following is true:

  * The value for the Path attribute is not a prefix of the request-URI.

Well, as documented, that wasn’t really web-compatible, and it’s kind of a theoretical concern (so long as you enforce path-match rules before handing out cookies from the cookie jar. ¯\_(ツ)_/¯). So Firefox commented out the conditional that would reject the cookie and added the comment above in question. As a result, people’s banks starting working in Firefox again (in 2002, remmeber, so people could check their online balance then hit up the ATM to buy Beyblades and Harry Potter merch, and whatever else was popular back then).

My colleague Lily pointed out that Chromium has a similar comment in canonical_cookie.cc:

The RFC says the path should be a prefix of the current URL path. However, Mozilla allows you to set any path for compatibility with broken websites.  We unfortunately will mimic this behavior.  We try to be generous and accept cookies with an invalid path attribute, and default the path to something reasonable.

These days, rfc6265 (and 6265bis) is much more pragmatic and states exactly what Firefox and Chromium are doing:

…the Path attribute does not provide any integrity protection because the user agent will accept an arbitrary Path attribute in a Set-Cookie header.

Never one to pass up on an opportunity to delete things, I wrote some patches for Firefox and Chromium so maybe someone reading Cookie code in the future doesn’t get distracted.

Aside 1: Awkwardly my moz-phab account has been disabled, so I just attached the patch file using Splinter like it’s 2002 (more Medieval code review tech references).

Aside 2: Both of these comments have two spaces after periods. Remember that?


This content originally appeared on Mike Taylr Dot Com Web Log and was authored by Mike Taylor


Print Share Comment Cite Upload Translate Updates
APA

Mike Taylor | Sciencx (2021-02-08T06:00:00+00:00) Obsolete RFCs and obsolete Cookie Path checking comments. Retrieved from https://www.scien.cx/2021/02/08/obsolete-rfcs-and-obsolete-cookie-path-checking-comments/

MLA
" » Obsolete RFCs and obsolete Cookie Path checking comments." Mike Taylor | Sciencx - Monday February 8, 2021, https://www.scien.cx/2021/02/08/obsolete-rfcs-and-obsolete-cookie-path-checking-comments/
HARVARD
Mike Taylor | Sciencx Monday February 8, 2021 » Obsolete RFCs and obsolete Cookie Path checking comments., viewed ,<https://www.scien.cx/2021/02/08/obsolete-rfcs-and-obsolete-cookie-path-checking-comments/>
VANCOUVER
Mike Taylor | Sciencx - » Obsolete RFCs and obsolete Cookie Path checking comments. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/02/08/obsolete-rfcs-and-obsolete-cookie-path-checking-comments/
CHICAGO
" » Obsolete RFCs and obsolete Cookie Path checking comments." Mike Taylor | Sciencx - Accessed . https://www.scien.cx/2021/02/08/obsolete-rfcs-and-obsolete-cookie-path-checking-comments/
IEEE
" » Obsolete RFCs and obsolete Cookie Path checking comments." Mike Taylor | Sciencx [Online]. Available: https://www.scien.cx/2021/02/08/obsolete-rfcs-and-obsolete-cookie-path-checking-comments/. [Accessed: ]
rf:citation
» Obsolete RFCs and obsolete Cookie Path checking comments | Mike Taylor | Sciencx | https://www.scien.cx/2021/02/08/obsolete-rfcs-and-obsolete-cookie-path-checking-comments/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.