Page MenuHomePhabricator

Add mediawiki.cookie module to allow reading and writing cookies with correct settings
Closed, ResolvedPublic


We should add a mediawiki.cookie module to correctly read (though this case is trivial) and write cookies with the right settings. We have six variables controlling this ($wgCookiePath, $wgCookiePrefix, $wgCookieDomain, $wgCookieSecure, $wgCookieExpiration, $wgCookieHttpOnly). Only wgCookiePrefix is currently exposed.

Requiring code to use jQuery.cookie directly means they generally get these settings wrong, and sometimes don't set the path at all (meaning it will often fork into /w/ and /wiki/, and perhaps more).

We should provide a write wrapper that's as close to WebResponse->setcookie as possible, with necessary exceptions (e.g. HTTP-only doesn't make sense, since it wouldn't work). A read wrapper is useful for convenience, so you can use the same module for both.

Version: 1.22.0
Severity: enhancement



Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 1:49 AM
bzimport set Reference to bz49156.

Change 120806 had a related patch set uploaded by Phuedx:
[WIP] Add the mw.cookie module

Change 120806 merged by Robmoen:
Implement mediawiki.cookie module

I think this only needs to go in 1.24, unless someone needs it backported.