Requests for comment/Survey Cookies/Local Storage on Wikimedia

Your comments here.

Background
Legal is interested in better understanding the use of cookies and local storage on the Wikimedia sites. We currently have a Cookie statement that describes how certain cookies are used on the Wikimedia sites but we understand that this list may not be inclusive of all cookies and local storage, such as those created by the community.

We would like to develop tools to help us inventory all cookies and local storage usage so that we can better understand their usage and document them.

Some existing documentation of cookies and local storage can be found here (the same table can also be found on this page).

Problem
Searching through all the code that sets cookies is rather impractical. Mwgrep suggests there are about 1500 user scripts which set cookies. Ideally any method will help us find existing cookies/local storage as well as future ones.

Proposal
We are currently considering a solution involving a MediaWiki extension, which has a list of cookies (such as those from the Cookie statement), and compares the cookie names in the request against the list of cookie names. If there are cookies that are not on the list, it would log a message. As more cookies are discovered, this list of cookies can be expanded to filter them out.

Additionally we wish to discover the uses of LocalStorage. We can use a similar method, but on the client side, and perhaps use EventLogging to log the events.

We would like a review to see if this is the best method of surveying cookie and LocalStorage usage on Wikimedia, or if there would be another approach which would be better.