Page MenuHomePhabricator

[Bug] Users are unable to login on wikidata.org until they clear their cookies
Closed, ResolvedPublic

Description

People are reporting that they are unable to log into wikidata.org and being redirected even though they're not logged in. Clearing all cookies fixes the issue.

Reports:

Possible cause could be rOMWC0275738d2d10: Isolate wikidata.org cookies and CORS policies?

Event Timeline

Legoktm raised the priority of this task from to Unbreak Now!.
Legoktm updated the task description. (Show Details)

Had the same issue. Clearing cookies lets me log into Wikidata, but "locally". Logging into another Wikimedia site activates the "global" login for those. Both work now (no "you are centrally logged in" message on Wikidata again).

The way to go here is probably to unset the old cookies via varnish, if they exist. @BBlack can help with that.

Lydia_Pintscher renamed this task from Users are unable to login on wikidata.org until they clear their cookies to [Bug] Users are unable to login on wikidata.org until they clear their cookies.Aug 14 2015, 11:24 AM
Lydia_Pintscher set Security to None.
Lydia_Pintscher moved this task from incoming to consider for next sprint on the Wikidata board.

Does someone have the specific details here on what cookie name to wipe on requests to what domainname(s)?

As best I can tell from my own testing (but I think someone with deeper insight into the CORS change for (www|query).wikidata.org and S:UL and such would need to confirm this sounds sane): I was able to reproduce the issue, and I was able to apparently perma-fix it for myself by deleting the centralauth_Token cookie in my browser cookie set that was stored under "wikidata.org" (as opposed to www.wikidata.org).

From the server end, we can't tell what domain a cookie was set for, only that it matched for the browser's request. So we could, for example, put a hack in varnish to delete the centralauth_Token cookie on requests with the exact Host header "wikidata.org" just to kill the one problematic cookie, but users would actually have to visit https://wikidata.org/ to trigger the fix. We could maybe do that part by embedding a request to it in all accesses to www.wikidata.org temporarily or something like that. There might be some better application-level way of dealing with this, though.

A site notice would probably be really useful for WD users telling them what to do (yes, old technology)

@BBlack, if you're able to reproduce, can you capture the headers and send
them to me? Or post here if you're comfortable.

I'm guessing you ended up with two token/session cookies, and either guy
the wrong one or the browser sends both and we're parsing the wrong one
out. But would like to confirm

Change 231556 had a related patch set uploaded (by BBlack):
Attempt to fix CA token issue via double-value detection -> delete on .wikidata.org

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

Change 231556 merged by BBlack:
Attempt to fix CA token issue via double-value detection -> delete on .wikidata.org

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

Change 231558 had a related patch set uploaded (by BBlack):
wikidata.org cookie workaround: add comments re task and when it can be removed

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

Change 231558 merged by BBlack:
wikidata.org cookie workaround: add comments re task and when it can be removed

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

We think the workaround deployed via https://gerrit.wikimedia.org/r/231556 should fix this up well enough. It worked for @JanZerebecki who still had the old bad cookie, which the fixup wiped out. Can others confirm?

@csteipp Sorry I missed that. I don't have the tab open anymore. I don't remember the order but in the Cookie HTTP header there where two key-value pairs for centralauth_Token with different values. One for www.wikidata.org and one for .wikidata.org . See the patch for the regex that matched that situation. After that the .wikidata.org one was deleted. Should that also be fixed in CentralAuth?

@csteipp Sorry I missed that. I don't have the tab open anymore. I don't remember the order but in the Cookie HTTP header there where two key-value pairs for centralauth_Token with different values. One for www.wikidata.org and one for .wikidata.org . See the patch for the regex that matched that situation. After that the .wikidata.org one was deleted. Should that also be fixed in CentralAuth?

Yeah, I was mostly interested if that was in fact the issue. So confirmed.

To avoid this in the future, we could look at how CentralAuth gets the cookie and see if we can either identify the correct one or check all of the ones that come in.

Sadly there is no way to reproduce it once the cookies are deleted.

I hit this also tonight.

If it helps: I had two "centralauth_User" cookies: one for previously logged user and another one for currently logged user (I was relogging to another account)

Ah, that makes some logical sense. We should probably stripping duplicate _User the way we are for duplicate _Token to address the bulk of it....

Change 233086 had a related patch set uploaded (by BBlack):
Fix remaining wikidata login issues: duplicate CA User

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

Change 233086 merged by BBlack:
Fix remaining wikidata login issues: duplicate CA User

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

Pushed a fix for deleting the duplicate centralauth_User for wikidata.org, should be in effect globally now.

Added a notice to our homepage, a sitenotice seems annoying to me.

If you can still reproduce this, we need to know your cookies for wikidata.org and subdomains to be able to fix this. (At least the cookie names/keys, don't publicly publish the values. You can send me a private message through Phabricator or on wiki if you want to be sure to not accidentally publish something private.)

If you can still reproduce this, we need to know your cookies for wikidata.org and subdomains to be able to fix this. (At least the cookie names/keys, don't publicly publish the values. You can send me a private message through Phabricator or on wiki if you want to be sure to not accidentally publish something private.)

Reproduced and sent to @JanZerebecki and @aude

Change 234510 had a related patch set uploaded (by JanZerebecki):
Another CentralAuth double cookie workaround

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

Change 234510 merged by BBlack:
Another CentralAuth double cookie workaround

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

@Keegan Thx. Should be fixed now. Please retry.

Change 234517 had a related patch set uploaded (by BBlack):
refactor wikidata CA cookies workarounds a bit

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

Change 234517 merged by BBlack:
refactor wikidata CA cookies workarounds a bit

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

@Sjoerddebruin: This also fixed it for one of the people in the office who still had the issue. I think we can take down the note on the main page.

Change 238418 had a related patch set uploaded (by BBlack):
Remove wikidata CA cookie hacks

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

Change 238418 merged by BBlack:
Remove wikidata CA cookie hacks

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