Page MenuHomePhabricator

Temporary accounts: $wmgDisableAccountCreation causes temporary account autocreation to fail
Closed, ResolvedPublic

Description

Summary

When Temporary accounts are enabled on a wiki it causes the creation of an account. However, on WMF wikis we have some wikis where the creation of an account is not allowed for anon users. We want to disable anon editing on these wikis to avoid exposing the IP address used by a temporary account.

Background

  • Temporary accounts can be enabled on a wiki, which causes a temporary account to be created when a user makes their first edit while logged out
  • The RealTempUserConfig::shouldAutoCreate method is called to determine if a temporary account should be created for an edit
    • This method checks that the user has the authority needed to create an account (via the createaccount right)
    • This fails on wikis where $wmgDisableAccountCreation is true, because that causes createaccount to be revoked from all users
  • When a user tries to edit a wiki without the createaccount right being given to all users and also which has temporary accounts enabled then:
    • The EditPage class determines that temporary account autocreation is not supported for the edit action
    • The revision attempts to be saved, but a CannotCreateActorException is thrown because the performer is marked as an IP
    • This also means that if the user hits an AbuseFilter targeting their edit, they will have AbuseFilter logs associated with their IP publicly visible as if temporary accounts were not enabled
  • Therefore, temporary account autocreation is incompatible with $wmgDisableAccountCreation in the current form
    • To solve this we can do one or some of the following:
      • Make temporary account autocreation skip the createaccount check
      • Disable anon editing on all wikis with $wmgDisableAccountCreation set
      • Don't throw the CannotCreateActorException if the createaccount right is missing from the * group
  • The wikis which have $wmgDisableAccountCreation set are foundationwiki, wikimaniawiki, and wikidatatestwiki
    • foundationwiki has anon editing disabled, wikimaniawiki has anon editing disabled via an edit filter, and wikidatatestwiki is as test wiki which disabled account creation due to spam

Technical notes

  • Temporary account autocreation for their first action (such as editing) should check if the user can autocreateaccount instead of createaccount

Acceptance criteria

  • Temporary accounts feature works when $wmgDisableAccountCreation is set but anon editing is still allowed

Event Timeline

Given that wikimaniawiki has an AbuseFilter that disables logged out editing for everyone, I'm going to set edit => false for the * group like foundationwiki. This is intended as a temporary fix and we should fully address this ticket.

Change #1182587 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[operations/mediawiki-config@master] Temp accounts: Disable logged out editing on wikimaniawiki

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

Change #1182587 merged by jenkins-bot:

[operations/mediawiki-config@master] Temp accounts: Disable logged out editing on wikimaniawiki

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

Mentioned in SAL (#wikimedia-operations) [2025-08-27T15:45:11Z] <dreamyjazz@deploy1003> Started scap sync-world: Backport for [[gerrit:1182587|Temp accounts: Disable logged out editing on wikimaniawiki (T403067)]]

Mentioned in SAL (#wikimedia-operations) [2025-08-27T15:51:02Z] <dreamyjazz@deploy1003> dreamyjazz: Backport for [[gerrit:1182587|Temp accounts: Disable logged out editing on wikimaniawiki (T403067)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2025-08-27T16:02:40Z] <dreamyjazz@deploy1003> Finished scap sync-world: Backport for [[gerrit:1182587|Temp accounts: Disable logged out editing on wikimaniawiki (T403067)]] (duration: 17m 29s)

  • Make temporary account autocreation skip the createaccount check

I like this. There can be wikis that want to disallow account creation, but want to allow anonymous editing (for example if anons have more limited rights, like not being able to edit content namespaces, while named users immediately get higher access level upon registration).

To solve this we can do one one or some of the following:

  • Make temporary account autocreation skip the createaccount check
  • Disable anon editing on all wikis with $wmgDisableAccountCreation set
  • Don't throw the CannotCreateActorException if the createaccount right is missing from the * group

Among these, the second option sounds like the easiest to me. Especially given the foundationwiki already has anon editing disabled and wikidatatestwiki is as test wiki which disabled account creation. That leaves wikimaniawiki where we can talk to the right team(s) to disable anon editing -- it doesn't make a lot of sense for that wiki to allow anon editing given that it is for an event for experienced editors.

@Dreamy_Jazz are there concerns against this approach?

To solve this we can do one one or some of the following:

  • Make temporary account autocreation skip the createaccount check
  • Disable anon editing on all wikis with $wmgDisableAccountCreation set
  • Don't throw the CannotCreateActorException if the createaccount right is missing from the * group

Among these, the second option sounds like the easiest to me. Especially given the foundationwiki already has anon editing disabled and wikidatatestwiki is as test wiki which disabled account creation. That leaves wikimaniawiki where we can talk to the right team(s) to disable anon editing -- it doesn't make a lot of sense for that wiki to allow anon editing given that it is for an event for experienced editors.

@Dreamy_Jazz are there concerns against this approach?

The second approach does not solve this problem for third-party wikis, so going with that option may not be ideal

However, the first option may be better here from my point of view:

  • The first option may be the easiest approach from a technical point of view (we could make the check instead be against whether a user can autocreateaccount which is a one line change)
  • Option 1 would solve the problem for any third-party wiki that has disabled permanent account creation but allows anon editing
  • T403067#11126861 suggests that this might be the preferred option for the community?

Thanks for explaining. I'm okay with us going with option 1.

Okay, thanks for your input. I have updated the task to refer to us going with Option 1 and will move this to the 'Ready' column

  • T403067#11126861 suggests that this might be the preferred option for the community?

Please note that I only spoke for myself; I don’t represent “the community”, only a single member of it. (Or maybe not even that: I don’t administer any non-WMF wiki, so I’m not really affected by this change.) Of course I still support the option I supported two weeks ago, but please don’t take me for “the community” if you seek wider community input.

  • T403067#11126861 suggests that this might be the preferred option for the community?

Please note that I only spoke for myself; I don’t represent “the community”, only a single member of it. (Or maybe not even that: I don’t administer any non-WMF wiki, so I’m not really affected by this change.) Of course I still support the option I supported two weeks ago, but please don’t take me for “the community” if you seek wider community input.

Sure. I think that point was a minor one at best, so I think going with the first option is still best here

Change #1187504 had a related patch set uploaded (by Tchanders; author: Tchanders):

[mediawiki/core@master] Allow temp account creation if anons have `autocreateaccount` right

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

The above patch implements the favoured approach, outlined in T403067#11162766.

Note that even with this, we could still have the following situation:

$wgGroupPermissions['*']['createaccount'] = false;
$wgGroupPermissions['*']['autocreateaccount'] = false;
$wgAutoCreateTempUser['enabled'] = true;
$wgGroupPermissions['*']['edit'] = true;

...In which case, the user is shown the customary warning in the editor that their edit will be assigned to their IP address, then the edit fails due to CannotCreateActorException when attempting to create the IP actor (and any abuse filter hits will log their IP address).

Hopefully it's clear that these config are not really compatible:

$wgGroupPermissions['*']['autocreateaccount'] = false;
$wgAutoCreateTempUser['enabled'] = true;

...But the patch also documents this just in case.

Change #1187504 merged by jenkins-bot:

[mediawiki/core@master] Allow temp account creation if anons have `autocreateaccount` right

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