Create a Wikimedia login domain that can be served by any wiki
Closed, ResolvedPublic

Description

For Wikimedia's central login system (SUL), we want to have a a single domain for storing a central session cookie that other domains (wikis) can rely on for authentication; and we want to do interactive login on that domain (T348388: SUL3: Use a dedicated domain for login and account creation - because browsers increasingly require user interaction with the cookie-storing domain before giving access to cookies); but we want the interaction on that domain to be similar to the interaction on the wiki where the user is logging in (in terms of i18n customizations, AbuseFilter/SpamBlacklist username rules etc).

One way to do this would be for the central login wiki's login page to fetch the relevant information from the origin wiki in a bunch of API calls and customize itself accordingly. This seems like a lot of effort with a long tail of small inconsistencies that will take forever to squash. An alternative approach would be to use a new domain, say https://sso.wikimedia.org/<wiki hostname>/, which would to resolve to the wiki specified in <wiki hostname> (ie. this page would be served by the same wiki from which the user started the login process, but under a different domain). We would limit what URLs can be accessed on this new domain, and add a bunch of config/hook overrides, like limiting what pages can be viewed and limiting user rights to only those needed for login, and maybe splitting some caches.

This would hugely simplify how displaying the central login page would work, although it would complicate the configuration system. I think (although I am not very sure) it would be a simpler approach on the net. It would also be a mixed change in terms of security - the login domain would be very much locked down compared to login.wikimedia.org (a real wiki), which is good, but it could be served by any wiki, ie. any backend code deployed in the Wikimedia cluster could potentially run on it, which is bad.

Also, for the reasons explained in T348388: SUL3: Use a dedicated domain for login and account creation, the URL used for interacting with cookies on the login domain will have to be user-visible (unless we use an iframe, which has security and browser compatibility disadvantages). Given "wikimedia" is less widely recognized than "wikipedia", this might pose its own UX challenges.

See also:

Related Objects

StatusSubtypeAssignedTask
OpenNone
Resolved Tgr
ResolvedOWresch-WMF
Resolved Tgr
Resolved Tgr
Resolvedsbassett
Resolved Tgr
Declined Tgr
Resolved Tgr
ResolvedSecurity Tgr
Resolvedmatmarex
Resolvedmatmarex
ResolvedArielGlenn
ResolvedArielGlenn
Resolvedmatmarex
Resolvedmatmarex
ResolvedArielGlenn
ResolvedJTweed-WMF
ResolvedDAlangi_WMF
DeclinedFeature Tgr
ResolvedDAlangi_WMF
Resolved Tgr
ResolvedArielGlenn
ResolvedArielGlenn
Resolved Tgr
Resolvedpmiazga
ResolvedDAlangi_WMF
Resolved Tgr
Resolved Tgr
Resolvedmatmarex
Resolved Tgr
Resolved Tgr
Resolvedmatmarex
DeclinedNone
Resolved Tgr
Resolved Tgr
Resolvedmatmarex
Resolvedsbassett
Resolved Tgr

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

There are two implementation strategies I can think of for such a shared domain:

  1. At the traffic level: ATS redirects sso.wikimedia.org/foowiki/path to foo.wikipedia.org/path so the target wiki mostly doesn't even notice what's going on (to some extent MediaWiki needs to be aware so I imagine we'd set a custom header).
  2. At the configuration level: CommonSettings.php applies some special logic when it determines from the hostname what DB name / wiki ID to use.

The first feels less messy, but I don't have a strong sense of pros/cons.

Either way, when a wiki is reached via sso.wikimedia.org, that would have to override some configuration settings: fail hard for non-SUL wikis (just in case, to avoid privacy leaks, although in theory there should not be any risk even without that), limit access to a predefined set of special pages (Special:Userlogin, Special:CreateAccount, in the future maybe things like change email, change password, change 2FA) and APIs (the APIs required for login/signup - meta=token, list=userinfo, list=globaluserinfo, meta=authmanagerinfo, action=clientlogin, action=createaccount, action=webauthn). The cookies we output would have to be different, not sure if that's a config-level change or an application-level change.

secure.wikimedia.org used to work in a similar way until it was replaced by T22643: Serve SSL/HTTPS sites out of same domain names as HTTP access: https://en.wikipedia.org/ (in 2013, I think?). It was implemented as an Apache proxy (still is, to some extent, to support old links).

Per discussion with Traffic, we'll explore implementing this in the MediaWiki configuration layer rather than some traffic routing layer.

A possible third approach that avoids the complexities of multiple wikis sharing a domain, and also avoids having to customize loginwiki, would be to keep submitting the login form on the local wiki, and then redirect to the central wiki for some sort of trivial workflow like clicking a button (which would be simple enough to not need any customization). It does have its own drawbacks though: more contrived UX (an extra step that makes no sense from the user's perspective), plus a secondary goal of SUL3 was to remove authentication workflows from local wikis so we can eventually reduce the threat surface.

@pmiazga pointed out that using an URL structure like https://sso.wikimedia.org/en.wikipedia.org/wiki/Special:Userlogin might be mistaken for phishing by some users (most people don't recognize the "wikimedia" brand, and putting a domain name in the URL is an existing phishing trick). Left a question about that in the SUL3 design review task: T365298#9886304

Quick review of all the places where loginwiki is mentioned (per this search):

  • the editinterface permission is disabled on loginwiki. Using a shared domain will be less secure in that regard.
  • $wgCentralAuthAutoCreateWikis. Not really affected.
  • $wmgUseGlobalCssJs is disabled. Doesn't really matter, user CSS/JS is disabled on authentication-related special pages anyway.
  • $wgCheckUserLogLogins is disabled (per T253802#6557466). Should ask stewards about this.
  • CentralNotice, Parsoid, Math, Disambiguator, UniversalLanguageSelector, PagedTiffHandler, parser functions, TemplateData, CharInsert are disabled (T61702). CentralNotice is security-relevant as banners can execute Javascript; we should probably replicate that. UniversalLanguageSelector might be good to have (the default loginpage language selector has poor UX). We probably need parser functions because of i18n message overrides. The rest don't matter much.
  • $wgEnableEventBus (docs) is restricted. Not sure about the significance of this.
  • there's a write-on-GET exception for loginwiki URLs. We should probably reproduce that.
  • CentralAuth adds loginwiki to various CSP fields. We probably won't need that.
  • CentralAuth adds DNS prefetch for login.wikimedia.org. We should probably reproduce that.
  • the editinterface permission is disabled on loginwiki. Using a shared domain will be less secure in that regard.

Only for local administrators, of which there are 0. Stewards, staff, new wikis importers, sysadmins, and global interface editors still have access through the global groups.

The decision is to use `https://auth.wikimedia.org/{{wikiid}, eg:

https://auth.wikimedia.org/enwiki/wiki/Special:Userlogin

  • $wmgUseGlobalCssJs is disabled. Doesn't really matter, user CSS/JS is disabled on authentication-related special pages anyway.

Nevertheless, done as part of T373738: Audit special pages used on the SUL3 shared login domain for disallowing user JS.

Since there is no separate login wiki anymore, this basically just comes down to "do we want to log IPs for logins?". Per T381223: useragent-clienthints API does not work on the SUL3 authentication domain the answer is yes.

  • CentralNotice, Parsoid, Math, Disambiguator, UniversalLanguageSelector, PagedTiffHandler, parser functions, TemplateData, CharInsert are disabled (T61702). CentralNotice is security-relevant as banners can execute Javascript; we should probably replicate that. UniversalLanguageSelector might be good to have (the default loginpage language selector has poor UX). We probably need parser functions because of i18n message overrides. The rest don't matter much.

Done in T373738: Audit special pages used on the SUL3 shared login domain for disallowing user JS (to the extend it proved feasible - configuration, DB and cache sharing between the normal wiki and wiki-accessed-via-authentication-domain makes disabling complex extensions risky).

Still not sure about the significance of this, but since the authentication domain is just an alternative way of accessing the same wiki, not doing this should be fine.

We missed this one. Patch incoming.

  • CentralAuth adds loginwiki to various CSP fields. We probably won't need that.

We actually need that (at least once CSP is enforcement). Done in rECAU0bed631a089b: SUL3: Improve SUL3 autologin feature.

  • CentralAuth adds DNS prefetch for login.wikimedia.org. We should probably reproduce that.

Done in rECAU9f8ff1156fed: Special: Add support for central autologin in SUL3 mode.

(Probably for a while we want *both* loginwiki and the shared domain in the CSP exemptions / DNS prefetch. That's part of T375796: Synchronize SUL2 and SUL3 central browser state.)

Change #1114070 had a related patch set uploaded (by Gergő Tisza; author: Gergő Tisza):

[operations/puppet@production] Update CentralAuth multi-DC rules for SUL3

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

Change #1114070 merged by RLazarus:

[operations/puppet@production] Update CentralAuth multi-DC rules for SUL3

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

After all wikis transition to SUL3, login.wikimedia.org will be removed, correct? Or what role will it have alongside auth.wikimedia.org?

After all wikis transition to SUL3, login.wikimedia.org will be removed, correct?

No, loginwiki will remain.

After all wikis transition to SUL3, login.wikimedia.org will be removed, correct?

No, loginwiki will remain.

How will loginwiki still be useful? Yes, stewards do checkuser on loginwiki for new accounts there, but this can be moved to metawiki.

How will loginwiki still be useful? Yes, stewards do checkuser on loginwiki for new accounts there, but this can be moved to metawiki.

Because not doing anything is easier than getting the community to agree with you.

Change #1123029 had a related patch set uploaded (by Gergő Tisza; author: Gergő Tisza):

[operations/puppet@production] [WIP] Update CentralAuth multi-DC rules for SUL3, attempt 2

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

Change #1123029 merged by Vgutierrez:

[operations/puppet@production] Update CentralAuth multi-DC rules for SUL3, attempt 2

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

Tgr claimed this task.