Page MenuHomePhabricator

Consider setting "Secure" on cookies that EFF HTTPS-Everywhere sets this on for us (tracking)
Open, MediumPublic

Description

HTTPS-Everywhere has some securecookie rules for WMF sites... I don't know if the "not secured by server" is necessarily correct, or was copied from elsewhere

https://github.com/EFForg/https-everywhere/blob/master/src/chrome/content/rules/Wikimedia.xml#L110-L120

	<!--	Not secured by server:
					-->
	<!--securecookie host="^\.wiki(books|data|mediafoundation|pedia|versity)\.org$" name="^GeoIP$" /-->
	<!--securecookie host="^(?:www\.)?wikidata\.org$" name="^WMF-Last-Access$" /-->
	<!--securecookie host="^en\.wikipedia\.org$" name="^(CentralAuthAnon|mediaWiki\.user\.sessionId|uls-previous-languages)$" /-->

	<securecookie host="^(?:www\.)?mediawiki\.org$" name=".+" />
	<securecookie host="^\.wik(?:ibooks|idata|imedia|imediafoundation|inews|ipedia|iquote|isource|iversity|ivoyage|tionary)\.org$" name="^GeoIP$" />
	<securecookie host="^(?:[^@:/]+\.)?wik(?:ibooks|idata|inews|ipedia|iquote|isource|iversity|ivoyage|tionary)\.org$" name=".+" />
	<securecookie host="^(?:species|commons|meta|incubator|wikitech)\.wikimedia\.org$" name=".+" />
	<securecookie host="^wikimediafoundation\.org$" name=".+" />

I'm presuming this would be more of a MW bug (ie the site is only HTTPS, and we're not setting the secure flag)... But either way, we should look at dealing with it :)

Event Timeline

Reedy raised the priority of this task from to Needs Triage.
Reedy updated the task description. (Show Details)
Reedy added subscribers: Reedy, csteipp.

As I put on irc, GeoIP and WMF-Last-Access are set from Varnish. sessionId is set from some javascript. They should probably all be set secure.

In general, all cookies from wmf sites can be set secure except the forceHTTPS cookie, which is intentionally set insecure so if we see it on plain http, we know we need to redirect the user.

And some background on the rules from https://www.eff.org/https-everywhere/rulesets, for anyone who's trying to figure them out.

Secure Cookies

Many HTTPS websites fail to correctly set the secure flag on authentication and/or tracking cookies. HTTPS Everywhere provides a facility for turning this flag on. For instance:

<securecookie host="^market\.android\.com$" name=".+" />
The "host" parameter is a regexp specifying which domains should have their cookies secured; the "name" parameter is a regexp specifying which cookies should be secured. For a cookie to be secured, it must be sent by a target host for that ruleset. It must also be sent over HTTPS and match the name regexp. For cookies set by Javascript in a web page, the Firefox extension can't tell which host set the cookie and instead uses the domain attribute of the cookie to check against target hosts. A cookie whose domain attribute starts with a "." (the default, if not specified by Javascript) will be matched as if it was sent from a host name made by stripping the leading dot.

In general, the rules at https://github.com/EFForg/https-everywhere/blob/master/src/chrome/content/rules/Wikimedia.xml#L110-L120 look ok to me-- they won't harm anything.

I'd like to be more strict on the top-level cookies and match all cookies like you do for the subdomain, but the "forceHTTPS" cookie then wouldn't get sent to http connections, and we loose that functionality. If we can match all cookies except forceHTTPS, that would be better.

In practice, we're redirecting to https for everything and setting hsts, so there's no theoretical need for the forceHTTPS cookie on WMF sites anymore, unless something else goes wrong in Varnish... which has happened.

I guess (?!forceHTTPS) in some way or another

fgiunchedi triaged this task as Medium priority.Apr 27 2016, 2:58 PM
BBlack subscribed.

Removing Traffic/Ops here, as the Traffic-layer cookies are all marked secure now.

Sweet :)

I guess we need to look and see what else needs dealing with at this point

Krinkle renamed this task from securecookies to Consider setting "Secure" on cookies that EFF HTTPS-Everywhere sets this on for us.Sep 25 2021, 9:43 PM
Krinkle renamed this task from Consider setting "Secure" on cookies that EFF HTTPS-Everywhere sets this on for us to Consider setting "Secure" on cookies that EFF HTTPS-Everywhere sets this on for us (tracking).