Page MenuHomePhabricator

Standadize user name normalization in MW
Open, MediumPublic

Description

Currently user name normalization is applied very inconsistently. For example, User::newFromName with make user name canonical, while (new User)->setName() allows you to pass in anything regardless of validity or normalization. This problem proliferates all the way to the DB layer - User::createNew will create a row in the actor and user tables with the name passed in with no normalization.

Other way around, when looking up users by name in the database we apply normalizations very selectively, so some codepaths look up by canonical name, while others not. All this works because of a fine balance between bugs.

We should start requiring that UserIdentityValue name be in a canonical form and then move the codebase towards this goal.

Actions TBD.

Related Objects

Event Timeline

Change 663252 had a related patch set uploaded (by Ppchelko; owner: Ppchelko):
[mediawiki/core@master] Hard-deprecate User::newSystemUser validation parameter.

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

Change 663252 merged by jenkins-bot:
[mediawiki/core@master] Hard-deprecate User::newSystemUser validation parameter.

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

Change 683597 had a related patch set uploaded (by Ppchelko; author: Ppchelko):

[mediawiki/core@master] ActorStore: Always canonicalize provided user name

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

Change 683597 merged by jenkins-bot:

[mediawiki/core@master] ActorStore: Always canonicalize provided user name

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