Page MenuHomePhabricator

CentralAuth extension: Code stewardship review
Closed, ResolvedPublic

Description

What:

CentralAuth is the system in charge of creating MediaWiki accounts on the (public) Wikimedia Foundation wikis. Users can create an account, log in, and have that same account across the different language editons of Wikipedia, as well as on sister projects such as Wikidata, Commons, Meta-Wiki, Wiktionary, mediawiki.org etc.

Its internal auto-login mechanism is essential to cross-wiki tooling, such as:

  • viewing an article in a different language (thus technically being on a different wiki) but remain logged-in there and thus able to receive notifications and make contributions.
  • making contributions to Wikidata without leaving the Wikipedia article.
  • uploading files to Commons from within VisualEditor and MobileFrontend.
  • following links to feedback forms on meta.wikimedia.org or mediawiki.org and still being logged-in.
  • board votes, steward elections etc, via vote.wikimedia.org (SecurePoll).
  • etc.

Motivation:

This system has effectively been without a manager or tech lead for about ten years. Issues are piling up. This has comes with numerous kinds of costs and risks:

Are there known security issues: Yes. I think the very definition of a Wikimedia-related security issue is almost synonymous with CentralAuth. It's what decides who's who and what they can do. It's what in charge of founder rights (e.g. Jimbo), stewards, WMF staff, etc.

The full list of on-going and recent security issues is too long to mention, but just a few then.

  • Risk of breach: T112359, T197150, …
  • Risk of leaking private data or shocking data: T112320, T226212, T201568, …
  • Vulnerability to faccilitate attacks against WMF elsewhere: T244682, …
  • Medium/Low?: T234371, T237274, …

Production outages or incidents: Yes. The most recent one I could find is T226840, where most articles could not be viewed by some logged-in users due to an HTTP header bug that would break the user's login session.

Does it have sufficient hardware resources for now and the near future (to take into account expected usage growth)?
TBD

Is it a frequent cause of monitoring alerts that need action, and are they addressed timely and appropriately?
Yes, it is regularly involved in prod errors that raise the alert levels. To my knowledge these are not currently reported, investigated or addressed (aside from CPT/RelEng during train deployments).

Screenshot 2020-05-08 at 21.23.43.png (683×2 px, 152 KB)

When it was first deployed to Wikimedia production

  1. https://meta.wikimedia.org/wiki/Help:Unified_login

Usage statistics based on audience(s) served
TBD

Changes committed in last 1, 3, 6, and 12 months
TBD

Number of developers who committed code in the last 1, 3, 6, and 12 months
TBD

Number and age of open patches
TBD

Number and age of open bugs
TBD

Number of known dependencies?
TBD

Is there a replacement/alternative for the feature? Is there a plan for a replacement? No.

Submitter's recommendation (what do you propose be done?)

For an existing team to take ownership.

Related Objects

Mentioned In
T359116: Split up CentralAuth into smaller extensions
T333541: Add CentralAuth to gated extensions
T244635: CentralAuth deletes session cookies when gadgets make requests to another wiki on IPBE account, causing session loss
T256185: unable to lock accounts on the mobile site
T289068: Normalise centralauth.gu_hidden
T267273: [arwiki] Submitting a POST on a form redirected to immediately after account creation sometimes logs user out
T280766: Phase out legacy error, warning and success classes for usage outside the parser
Mentioned Here
T242661: Use __Host- prefixed cookies for MediaWiki session cookies
T202028: CentralAuth fails when using "site isolation" in Google Chrome and Chromium or "first-party isolation" in Firefox
T256525: Stay logged in doesn’t work, global login doesn’t work on different projects
T335851: Investigate the Federated Credential Management browser API
T335125: Account creation attempt on mobile Wikipedia domain leads user to desktop Special:CentralLogin/complete, often in logged-out state
T226797: CentralAuth login session and auto-login no longer work across wikis in Safari and Firefox
T299193: MediaWiki login failure due to race condition with session cookie
T267273: [arwiki] Submitting a POST on a form redirected to immediately after account creation sometimes logs user out
T68828: CentralAuth: Audit autologin procedure for performance and code quality
T106276: Certain Memcached keys are retrieved multiple times for a single page view
T130935: CentralAutoLogin delays fully load time
T150506: Avoid lazyImportLocalNames() master writes on GET requests (Run a script to backfill them once for all)
T197150: User right changes should require elevated security
T226840: Consistent HTTP 503 Error on some urls for some logged-in users (CentralAuth Set-Cookie storm)
T231961: DBPerformance warning: "Expectation masterConns <= 0 not met" from CentralAuth special pages
T237274: CentralAuth created local blocks do not necessarily have correct blocker ID
T237765: Some error messages are not being localized
T252236: Prepare CentralAuth (e.g. login.wikimedia.org) for requirement of SameSite=None cross-site cookies in Chrome

Event Timeline

Krinkle renamed this task from Code stewardship review: CentralAuth (login.wikimedia.org) to CentralAuth extension: Code stewardship review.May 8 2020, 8:56 PM
Jrbranaa triaged this task as High priority.Jun 3 2020, 7:09 PM
Jrbranaa moved this task from Backlog to Prioritized on the Code-Stewardship-Reviews board.

5 years and two days ago I outlined my incredibly simple plan to get rid of CentralAuth: https://www.mediawiki.org/wiki/User:Legoktm/evil-plans2.txt (loosely inspired by I believe brion's original evil-plans.txt).

The SULF and AuthManager projects got rid of an immense amount of tech debt, but I think eliminating it is the ideal way to move forward. That's easier said than done, but I think the first step is to identify how exactly to break it up (SSO, wikisets, user rights, renaming, unification, ...) and where the pieces should land. And then as things are moved, we can use that opportunity to refactor them, add tests, etc. And smaller chunks of code are easier to maintain and spread the responsibility around.

Having spent some hours poking around this code while debugging T267273: [arwiki] Submitting a POST on a form redirected to immediately after account creation sometimes logs user out (tl;dr: unknown numbers of users are being logged-out immediately after creating an account on Wikipedia, not a great user experience), please, yes, this needs a steward, or needs to be removed/broken up per T252244#6339170. Starting with assigning a team to maintain the extension in a meaningful way is a good start, and they could then determine what to do with it.

@Jrbranaa is there an update on the code stewardship review for this extension?

5 years and two days ago I outlined my incredibly simple plan to get rid of CentralAuth: https://www.mediawiki.org/wiki/User:Legoktm/evil-plans2.txt (loosely inspired by I believe brion's original evil-plans.txt).

The SULF and AuthManager projects got rid of an immense amount of tech debt, but I think eliminating it is the ideal way to move forward. That's easier said than done, but I think the first step is to identify how exactly to break it up (SSO, wikisets, user rights, renaming, unification, ...) and where the pieces should land. And then as things are moved, we can use that opportunity to refactor them, add tests, etc. And smaller chunks of code are easier to maintain and spread the responsibility around.

Adding tech-decision-forum to take up discussion of this task and hopefully move us towards solutions.

For everyone's info, currently no Code-Stewardship-Reviews are taking place as there is no clear path forward and as this is not prioritized work.
(Entirely personal opinion: I also assume lack of decision authority due to WMF not having a CTO currently. However, discussing this is off-topic for this task.)

@Krinkle did you remove this proposal from the tech decision forum process? If so, I'd like to resubmit it (cc @LNguyen). For context, I'm coming here from T299193: MediaWiki login failure due to race condition with session cookie.

@Krinkle did you remove this proposal from the tech decision forum process?

I neither added it to, nor withdrew it from, the TDMP.

[ tagging our team as one of our core, day-to-day extensions ]

Bounce tracking mitigations (supposedly deployed in Chrome some time after the third-party cookie phaseout at the end of 2024) will probably put the final nail in the coffin of CentralAuth edge/autologin.

First-Party Sets might solve this and similar problems with cookie state partitioning etc, eventually, but Chrome is moving slowly on that and the other vendors seem to be hostile to the idea.

T335851: Investigate the Federated Credential Management browser API is another possible future direction that might preserve some of the functionality.

This has been discussed in many places, but I don't think it has been spelled out in this task: CentralAuth's login system is based on a standalone identity provider site with a "central cookie" and "central session" being the source of truth for login status, and being able to provide that status to other domains in various unobtrusive ways (i.e. without the user having to click a login button every time they go to another wiki). Unfortunately this is the same mechanism the adtech industry uses for intrusive user tracking across unrelated websites, and browsers are increasingly aggressive about preventing such techniques. CentralAuth's login features will probably become collateral damage in that process (and to a significant extent they already have: T202028: CentralAuth fails when using "site isolation" in Google Chrome and Chromium or "first-party isolation" in Firefox, T226797: CentralAuth login session and auto-login no longer work across wikis in Safari and Firefox, T256525: Stay logged in doesn’t work, global login doesn’t work on different projects).

There is plenty of functionality in CentralAuth that's not directly related to login (a central authorization system, ie. stewards; user renaming; some centralized anti-abuse functionality related to registration) which is conceptually not problematic, just suffers from low code quality due to a decade of neglect.

CentralAuth authentication, at least as used at Wikimedia, is based on setting cookies on parent domains. Arguably this is an antipattern that makes it harder to maximize cookie security (T242661: Use __Host- prefixed cookies for MediaWiki session cookies).

I'm resolving this request: The MediaWiki Engineering Group will take on stewardship for CentralAuth, supported by Security-Team (cc @acooper). @MNadrofsky is going to update the developers/maintainers list. You can use MediaWiki-Platform-Team as tag if you'd like to get things surfaced to the team.