Last modified: 2014-08-17 07:04:59 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T70843, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 68843 - MassMessage::getMessengerUser() takeover broken due to Password API changes
MassMessage::getMessengerUser() takeover broken due to Password API changes
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
MassMessage (Other open bugs)
unspecified
All All
: Highest major (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-07-30 05:01 UTC by Kunal Mehta (Legoktm)
Modified: 2014-08-17 07:04 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Kunal Mehta (Legoktm) 2014-07-30 05:01:49 UTC
In MassMessage::getMessengerUser(), we do some evil things to create a system account that cannot be logged into:

$user = User::newFromName( $wgMassMessageAccountUsername );
$user->load();
if ( $user->getId() && $user->mPassword == '' && $user->mNewpassword == '' ) {
	// We've already stolen the account
	return $user;
}


Problems here are:

a) User::load() no longer loads the password members, so we can't check if they are equal to empty string.
b) null == '', should have been using triple equals.


Also, AbuseFilter has a very similar function (I got the idea from it), so we'll need to patch this there too.
Comment 1 Kunal Mehta (Legoktm) 2014-07-30 05:09:27 UTC
From my reading of User::setInternalPassword(), an InvalidPassword-type password is saved for the user. But I don't see any non-hacky way for me to check whether a user has that password type. Am I missing something?
Comment 2 Tyler Romeo 2014-07-30 10:29:10 UTC
:/ is there a reason an actual account is being created and registered (as opposed to just adding the username to $wgReservedUsernames)?
Comment 3 Kunal Mehta (Legoktm) 2014-07-30 17:12:55 UTC
(In reply to Tyler Romeo from comment #2)
> :/ is there a reason an actual account is being created and registered (as
> opposed to just adding the username to $wgReservedUsernames)?

Yes. We do this so local wikis can adjust the accounts' user groups if they wish to (some remove it from the "bot" group it auto-adds itself to), or if they want to block the account for whatever reason.
Comment 4 wctaiwan 2014-07-31 07:15:43 UTC
The password API changes in question were https://gerrit.wikimedia.org/r/#/c/77645/

The breaking test has been temporarily commented out in https://gerrit.wikimedia.org/r/#/c/150770/
Comment 5 Kunal Mehta (Legoktm) 2014-08-03 19:51:56 UTC
Ideas on how to fix...

* Have User::load() call loadPasswords() - fixes all back-compat issues
* Make loadPasswords() public
* Add getPassword()/getTemporaryPassword() accessors and make the member variables private
* Have MM call checkPassword() with a dummy value and then check ->mPassword directly (ewwww)
Comment 6 Tyler Romeo 2014-08-03 23:45:16 UTC
(In reply to Kunal Mehta (Legoktm) from comment #5)
> Ideas on how to fix...
> 
> * Have User::load() call loadPasswords() - fixes all back-compat issues

Would rather not, for the same reason load() does not call loadOptions()

> * Make loadPasswords() public

This makes sense, and I'm not even sure why I didn't make it public in the first place.

> * Add getPassword()/getTemporaryPassword() accessors and make the member
> variables private

This also makes sense. And while we're at it, also make $mId, $mName, $mRealName, etc. private since you shouldn't be accessing those directly either.

> * Have MM call checkPassword() with a dummy value and then check ->mPassword
> directly (ewwww)

> ewwww

Agreed. Stick with above.
Comment 7 Kunal Mehta (Legoktm) 2014-08-04 01:48:46 UTC
(In reply to Tyler Romeo from comment #6)
> (In reply to Kunal Mehta (Legoktm) from comment #5)
> > * Make loadPasswords() public
> 
> This makes sense, and I'm not even sure why I didn't make it public in the
> first place.

If we add the accessors, there should be no reason to do this I think.

> 
> > * Add getPassword()/getTemporaryPassword() accessors and make the member
> > variables private
> 
> This also makes sense. And while we're at it, also make $mId, $mName,
> $mRealName, etc. private since you shouldn't be accessing those directly
> either.

Ib79ce01a47f90af681e376ce918eda559b4b94a6. Will do a second patch once extensions accessing directly are fixed (MassMessage, AbuseFilter, OpenID).
Comment 8 Gerrit Notification Bot 2014-08-04 03:18:48 UTC
Change 151570 had a related patch set uploaded by Legoktm:
Fix MassMessage::getMessengerUser() after Password API changes

https://gerrit.wikimedia.org/r/151570
Comment 9 Gerrit Notification Bot 2014-08-09 11:22:55 UTC
Change 151570 merged by jenkins-bot:
Fix MassMessage::getMessengerUser() after Password API changes

https://gerrit.wikimedia.org/r/151570
Comment 10 Gerrit Notification Bot 2014-08-09 11:30:57 UTC
Change 153042 had a related patch set uploaded by Legoktm:
Fix MassMessage::getMessengerUser() after Password API changes

https://gerrit.wikimedia.org/r/153042
Comment 11 Gerrit Notification Bot 2014-08-10 23:24:43 UTC
Change 153042 merged by jenkins-bot:
Fix MassMessage::getMessengerUser() after Password API changes

https://gerrit.wikimedia.org/r/153042
Comment 12 Kunal Mehta (Legoktm) 2014-08-10 23:40:54 UTC
Deployed by Ori, thanks!
Comment 13 Gerrit Notification Bot 2014-08-17 06:59:34 UTC
Change 154449 had a related patch set uploaded by Wctaiwan:
Fix MassMessage::getMessengerUser() after Password API changes

https://gerrit.wikimedia.org/r/154449
Comment 14 Gerrit Notification Bot 2014-08-17 07:01:32 UTC
Change 154449 merged by jenkins-bot:
Fix MassMessage::getMessengerUser() after Password API changes

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

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links