Page MenuHomePhabricator

Create a Wikimedia login domain that can be served by any wiki
Open, Needs TriagePublic

Description

This is a brainstorming-stage proposal. Don't take it too seriously yet.

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: Use central login wiki for login (SUL3) - 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/<wikiID>/, which would to resolve to the wiki specified in <wikiID> (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.

See also: T120484: Create password-authentication service for use by CentralAuth (replace loginwiki entirely with a small dedicated app)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

This would be an alternative to T363411: Run cancreateaccount checks in the context of another wiki (and a number of other potential tasks related to i18n, the SpecialCreateAccountBenefits hook, language variant conversion, and probably some more things).

T215071 <- throwing this in here for semi-related context. Maybe we can align on a potential common future URI scheme anyways, while not actually yet tackling that one.

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).