Page MenuHomePhabricator

SameSite attribute for "UseDC" cookie
Closed, ResolvedPublic

Description

Firefox says

Some cookies are misusing the recommended “SameSite“ attribute
Cookie “UseDC” does not have a proper “SameSite” attribute value. Soon, cookies without the “SameSite” attribute or with an invalid value will be treated as “Lax”. This means that the cookie will no longer be sent in third-party contexts. If your application depends on this cookie being available in such contexts, please add the “SameSite=None“ attribute to it. To know more about the “SameSite“ attribute, read https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite api.php

Seems like this could lead to cross-wiki requests being routed to the wrong DC.

Details

Risk Rating
Low
Related Changes in Gerrit:

Event Timeline

Mstyles subscribed.

Untagging security team due to lack of bandwidth for engineering work on lower priority bugs. It would be great if the Mediawiki Platform Team could take a look at this.

Mstyles triaged this task as Medium priority.Dec 18 2023, 5:30 PM
Mstyles changed Risk Rating from N/A to Low.
Tgr subscribed.

I don't see how this is even remotely a security issue. In general, these tasks should probably be handled by the owners of the cookies (Data-Persistence in this case I guess?) - if it's OK that the cookie is not sent in cross-site requests set SameSite=Lax or just ignore the warning, if it's not OK (probably isn't in this case) set SameSite=None. But it would be nice if the task could be made public first.

Ladsgroup subscribed.

This is definitely not a Data persistence team issue, we don't own cookies for third party systems. Not even sure about our own prod.

UseDC is part of ChronologyProtector which is definitely not third party (not sure there are multi-DC MediaWiki installations other than Wikimedia). UseCDNCache wasn't either but got removed a while ago (rMW497f3f1359d6: Remove redundant and unused UseCDNCache cookie).

Apparently the RDBMS library is owned by API Platform (which is a bit weird, but OK) so tagging them instead.

Aklapper renamed this task from Misuse of SameSite cookie to Misuse of SameSite cookie for "UseDC" and "UseCDNCache".Dec 23 2023, 2:49 PM
Aklapper added a project: MediaWiki-libs-Rdbms.
Tgr renamed this task from Misuse of SameSite cookie for "UseDC" and "UseCDNCache" to No SameSite attribute for "UseDC" and "UseCDNCache" cookies.Dec 24 2023, 2:34 AM
Krinkle renamed this task from No SameSite attribute for "UseDC" and "UseCDNCache" cookies to SameSite attribute for "UseDC" cookie.Jul 8 2026, 9:56 AM
Krinkle changed the visibility from "Custom Policy" to "Public (No Login Required)".
Krinkle changed the edit policy from "Custom Policy" to "All Users".
Krinkle changed the subtype of this task from "Security Issue" to "Task".
Krinkle subscribed.

it looks to me like this is still a pending issue, and that a small patch to https://gerrit.wikimedia.org/g/mediawiki/core/+/472b691fb3dba77a298eb3a23fd2aa58edae75ba/includes/MediaWikiEntryPoint.php#354 to add the Secure flag and also the SameSite attribute with "none" value, might do it. But I'm not at all familiar with ChronologyProtector, there could well be context I don't have.

it looks to me like this is still a pending issue, and that a small patch to https://gerrit.wikimedia.org/g/mediawiki/core/+/472b691fb3dba77a298eb3a23fd2aa58edae75ba/includes/MediaWikiEntryPoint.php#354 to add the Secure flag and also the SameSite attribute with "none" value, might do it. But I'm not at all familiar with ChronologyProtector, there could well be context I don't have.

That sounds reasonable.

Change #1313463 had a related patch set uploaded (by ArielGlenn; author: ArielGlenn):

[mediawiki/core@master] Make the UseDC cookie work across different domains

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

Change #1313463 merged by jenkins-bot:

[mediawiki/core@master] Make the UseDC cookie work across different domains

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

Once this change has gone around to all wiki deployment groups, this task can be closed, so likely at the end of the week.

Once this change has gone around to all wiki deployment groups, this task can be closed, so likely at the end of the week.

For typical MediaWiki patches, we move the task to "Demo ready" once everything has been merged.