Page MenuHomePhabricator

Have new system users be automatically attached to CentralAuth
Open, Needs TriagePublic

Description

When a MediaWiki farm is set up with some concept of global / central accounts, User::newSystemUser() should integrate with that.


Original task description:

On Wikimedia wikis, where MediaWiki-extensions-CentralAuth is used; the bot accounts used by MassMessage do not even appear as "unnatached" on https://meta.wikimedia.org/wiki/Special:CentralAuth/MediaWiki_message_delivery. This seems to be a bug of some sort.

New MassMessage system users should be automatically attached to CentralAuth upon new wiki creations.

This also allows local projects to get GlobalUserPage descriptions of those system accounts, reducing confusion.

(This was done in T275935: Please manually attach new MassMessage system accounts on Wikimedia wikis for MassMessage but still a problem more generally.)


See also:
T160666: AbuseFilter should use the same account name on all WMF projects

Event Timeline

Change 709211 had a related patch set uploaded (by Zabe; author: Zabe):

[mediawiki/extensions/MassMessage@master] Attach new MassMessage accounts to the global account

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

Not realy a duplicate. The other task is about attaching the accounts in wikimedia production, while this one is about making this happen automatically.

Change 715805 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/core@master] Call LocalUserCreatedHook from User::newSystemUser on creation

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

Legoktm subscribed.

Change 715805 abandoned by Umherirrender:

[mediawiki/core@master] Call LocalUserCreatedHook from User::newSystemUser on creation

Reason:

May not the best way to fix this

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

Change 709211 abandoned by Zabe:

[mediawiki/extensions/MassMessage@master] Attach new MassMessage accounts to the global account

Reason:

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

matmarex subscribed.

This problem affects everything using User::newSystemUser(), so I'll rephrase the task.

matmarex renamed this task from Have new MassMessage system users be automatically attached to CentralAuth to Have new system users be automatically attached to CentralAuth.Jun 10 2025, 11:26 PM
matmarex removed a project: MassMessage.

I think we should just add a new hook inside User::newSystemUser() and have CentralAuth implement it. it may be a bit ugly, but other options seem uglier.

Tgr updated the task description. (Show Details)

Some considerations from the other task:

What if the central account does not exist yet? What if it exists but isn't a system user (and you are using the steal flag)? We don't even have an isSystemUser() equivalent for central users.

Flow does this manually (in TalkpageManager::getTalkpageManager()) by creating a system user and then calling CentralAuthUser::attach( <wiki id>, 'admin' ).

In proposed account vanishing procedure in https://gerrit.wikimedia.org/r/c/mediawiki/extensions/CentralAuth/+/1050675/3/includes/GlobalRename/GlobalRenameUser.php we used User::newSystemUser() with the steal option to make an account unusable. However it will also make the user displayed as system user (isSystemUser) in various places. (The DisableAccount extension already did revoke user's access this way, though it is was not installed in any SUL wikis before undeployed from Wikimedia.)

An alternative solution is to reopen T212720: System users should be in a dedicated user group, which at least provides a better way to detect system accounts than the current one.

More comments copied from merged tasks:

I propose that we can introduce a new user name format for system user names. For example the abuse filter blocker can be named User:@abusefilter-blocker in every wiki, and a localized named (stored in a MediaWiki message) can be shown in page history, recent changes and logs.

Since @ is not a valid character in new user name there are little risk of conflicts with existing users. There are no conflict with interwiki user name either (which always have a (.+)@([^@]+) format). Such accounts can safely be connected to SUL automatically.

In additional of the issues I described above, I do not believe the current way to detect system users (T212720#5661680) is a "cheap" one. Imagine if we need to filter out edits of system users from recent changes, we must query whether a user is system user one by one. In many cases, login credentials can be provided by an external system that may be another database (e.g. CentralAuth), or not MySQL at all. So it is not possible to join it with recent changes.