Page MenuHomePhabricator

The WMF-Last-Access Set-Cookie header should follow RFC 2965 syntax rather than the pre-RFC Netscape format
Closed, DeclinedPublic

Description

We send out cookies from set_last_access_cookie__ in modules/varnish/templates/analytics.inc.vcl.erb that look something like:

Set-Cookie: WMF-Last-Access=12-Oct-2016;Path=/;HttpOnly;secure;Expires=Sun, 13 Nov 2016 12:00:00 GMT

The Expires attribute of the Set-Cookie header was obsoleted in RFC 2109 (February 1997). That RFC was itself obsoleted by RFC 2965 (October 2000). The header should instead look something like:

Set-Cookie: WMF-Last-Access=12-Oct-2016;Path=/;HttpOnly;secure;Max-Age=2764800

Max-Age=value
OPTIONAL. The value of the Max-Age attribute is delta-seconds, the lifetime of the cookie in seconds, a decimal non-negative integer. To handle cached cookies correctly, a client SHOULD calculate the age of the cookie according to the age calculation rules in the HTTP/1.1 specification [RFC2616]. When the age is greater than delta-seconds seconds, the client SHOULD discard the cookie. A value of zero means the cookie SHOULD be discarded immediately. -- https://tools.ietf.org/html/rfc2965

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
bd808 renamed this task from The WMF-Last-Access Set-Cokkie header should follow RFC 2965 syntax rather than the pre-RFC Netscape format to The WMF-Last-Access Set-Cookie header should follow RFC 2965 syntax rather than the pre-RFC Netscape format.Oct 12 2016, 8:27 PM

I've found some blog post from 2012 that discuss IE6, 7 & 8 not supporting Max-Age and suggesting setting both Expires and Max-Age. Thanks IE.

We use expires in our CP cookies as well (which track connection properties for HTTP/2 stats), so that's probably in the same scope. I'd suggest blocking this on the seemingly-unrelated T147199 , as most IE8 (and lower) will be unable to connect to our services once that's complete.

ema triaged this task as Medium priority.Oct 13 2016, 11:13 AM
ema moved this task from Backlog to Caching on the Traffic board.
Jdforrester-WMF subscribed.

I'd suggest blocking this on the seemingly-unrelated T147199 , as most IE8 (and lower) will be unable to connect to our services once that's complete.

I've inverted the parentage of this task given your comment, as that seems to be what was intended.

Change 637851 had a related patch set uploaded (by Ladsgroup; owner: Ladsgroup):
[operations/puppet@production] varnish: Replace "Expires" in Set-Cookie with "Max-Age"

https://gerrit.wikimedia.org/r/637851

The swap of Traffic for Traffic-Icebox in this ticket's set of tags was based on a bulk action for all such tickets that haven't been updated in 6 months or more. This does not imply any human judgement about the validity or importance of the task, and is simply the first step in a larger task cleanup effort. Further manual triage and/or requests for updates will happen this month for all such tickets. For more detail, have a look at the extended explanation on the main page of Traffic-Icebox . Thank you!

Ladsgroup subscribed.

It seems RFC 6265 actually brought back Expires (https://datatracker.ietf.org/doc/html/rfc6265#section-5.2.1) and explicitly obsoleted RFC 2965 (see the "Obsoletes" section) and given that there are some privacy concerns with the replacement as well: https://gerrit.wikimedia.org/r/c/operations/puppet/+/637851/3#message-53c1ff641d879087f1890d5f2bddeeb3b77332b7 I boldly decline this ticket.

Change 637851 abandoned by Ladsgroup:

[operations/puppet@production] varnish: Replace \"Expires\" in Set-Cookie with \"Max-Age\"

Reason:

See the ticket.

https://gerrit.wikimedia.org/r/637851