Page MenuHomePhabricator

MediaWiki CLI installer should check wiki admin password validity before starting
Closed, ResolvedPublic

Description

If the installer is given an invalid (too simple etc.) wiki admin password (which is not that hard to do with the new, stricter rules that are default for MW 1.35), it will mostly set up the database, then abort with an error. (Only seen in the CLI installer, in Varnish, but the CLI and web installer code are close enough that the same will probably happen in both.) That's pretty terrible for user experience.

The password should be checked for validity before installation starts.

Event Timeline

(Before 3df9742b32 there was a normal error instead of an exception, but that's not much better, either.)

The exception re-introduced by 3df9742b32 is actually correcting a problem that was not detected for a long time. User::setPassword normally used to throw exception if the password failed verification, until when r280945 changed it to return boolean. Since then the exception thrown in Installer stopped working until when 3df9742b32 corrected it again.

Yeah, I misunderstood what happened there; apparently setPassword is documented as throwing an exception on failure and also returning a boolean success flag, but before rMW854a462dc0ae: Remove $wgDisableAuthManager it only used the exception for indicating failure and after that change it only used the flag, and that broke the installer (and presumably other things). So the current error handling behavior is not new and thus not a release blocker. Nevertheless I think it's poor and should be improved.

(Also, let's make sure we get rid of setPassword before the LTS release so any subtly broken third-party code will be broken visibly, at least. Thanks for all your work towards that in T249181: Remove usages and drop hard deprecated User methods!)

Tested this properly. The web installer in fact doesn't have this issue; it properly validates the password on form submission. The CLI installer just dies after creating the database. Re-running the installer will seemingly succeed (the DB already exists so it doesn't try to create an admin user, I suppose) but wiki will not be functional. The user needs to manually delete the tables before being able to continue.

Change 612169 had a related patch set uploaded (by Gergő Tisza; owner: Gergő Tisza):
[mediawiki/core@master] CliInstaller: fail in a sane way when the password is invalid

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

Legoktm renamed this task from MediaWiki installer should check wiki admin password validity before starting to MediaWiki CLI installer should check wiki admin password validity before starting.Jul 13 2020, 11:38 AM

Change 612169 merged by jenkins-bot:
[mediawiki/core@master] CliInstaller: fail in a sane way when the password is invalid

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

Tgr claimed this task.