Commit graph

839 commits

Author SHA1 Message Date
Platonides
bc7840f7d4 (bug 35961) Hash comparison should always be strict.
If your salted password end up being completely numeric when
represented in hexadecimal (less than 1 password per 10 millions),
it is also possible to login by providing another password that only
matches the first 9 bytes (instead of the full 16 ones) if it turns out
to also be completely numeric with your assigned salt (which is completely unknown).
The odds of finding an equivalent password with such characteristics, over a double md5
with an unknown salt, are really low. Even if the attacker broke into the servers and
robbed the salts, making use of this property would require a preimage attack of a partial
md5 (2^18) with the output of another md5 hash, for which a full preimage would still be
needed. Breaking the hashes using conventional attacks would be easier, so this is not
a critical update.

Change-Id: I8d1153fb91ca6507bd1df91e9953561f74f12ef6
2012-04-19 18:25:45 +02:00
Alexandre Emsenhuber
1f61fb0d65 Fix error from I55939bb5295e73594c3fdf7287dddbc16a233ce4 (r4099) pointed out by Nikerabbit
The error is "PHP Strict Standards:  Creating default object from empty value in includes/User.php on line 2142"; the problem was that I forgot to renamed an instance of that variable while refactoring the code.

Change-Id: I4e32311693708ec5a0227d60f7818b374fccd4cc
2012-04-05 20:02:59 +02:00
Alexandre Emsenhuber
5fc4d3739c Per Siebrand, follow-up I55939bb5295e73594c3fdf7287dddbc16a233ce4 (r4099):
* Add message documentation
* Changed 'emaildisabled' wording for better understandability
* Added @since comment in User::setEmailWithConfirmation() and @deprecated in Preferences::trySetUserEmail()

Change-Id: I73c4b82ff2493a26ffbab426f30cd9af5680e503
2012-04-03 18:44:06 +02:00
Alexandre Emsenhuber
eb6df43f2e Moved Preferences::trySetUserEmail() to User::setEmailWithConfirmation()
* Much more easier to find it in the User class than in Preferences and it's general enough to be in that class.
* Rewrote the function for better readbility
* It now always return a Status object so that it's easier to interpret its result.
* Update the only caller in core (in Special:ChangeEmail) and moved the PrefsEmailAdit hook there

Change-Id: I55939bb5295e73594c3fdf7287dddbc16a233ce4
2012-04-03 10:50:34 +02:00
Platonides
cd76555106 Unneeded globals after e2ee009e5 (aka. r114233)
Change-Id: I2ee0f3946e2b584db9952926900d425b8af1dd3b
2012-03-30 00:09:14 +02:00
Daniel Friesen
73d5d7a226 Fix broken email confirmation expiration caused by MWCryptRand changes.
Change-Id: I7ef0913074f372b5ace3d14993e0e3a914b9f22c
2012-03-25 20:48:20 -07:00
bsitu
28283a0de3 fix and comparison in pingLimiter
Change-Id: Ib8aa8ecf169acdf69c55f8c1dbce0d709fb9e852
2012-03-23 16:57:53 -07:00
Tim Starling
4b8e45d604 * Removed the $method parameters from MWCryptRand. Apparently Dantman didn't know about our awesome debug traceback functions like wfGetAllCallers(). The weird optional-middle-parameter calling convention thankfully disappears as a consequence.
* Reduced the amount of debug log noise slightly, removing a few redundant messages.
2012-03-21 10:27:34 +00:00
Tim Starling
34db0956e1 (bug 35316) On autocreate, use $this as the "doer" in the newuser log entry, since unlike User::addNewUserLogEntry(), there is no way the action could have been triggered by a different user. Usually $wgUser is set correctly, but there's no need to rely on it here. 2012-03-20 06:19:02 +00:00
Daniel Friesen
e2ee009e5c Commit the cryptrand project worked on in git:
- MWCryptRand: A new api for generating cryptographic randomness for security tokens. Uses whatever cryptographic source is available and if not falls back to using random state and clock drift.
- wfRandomString - A simple non-cryptographic pesudo-random string generation function to replace wfGenerateToken which was written pretending to be secure when it's really not.
- Core updates to use MWCryptRand in various places:
-- user_token generation (to do this we stop generating user_token implicitly and only generate it when needed to avoid depleting the system's entropy pool by reading random data we'll never use)
-- email confirmation token generation
-- password salt generation
-- temporary password generation
-- Generation of the automatic watchlist token
-- login and create user tokens
-- session ids when php's entropy sources are not set
-- the installer when generating wgSecretKey and the upgrade key
2012-03-20 05:17:40 +00:00
Alexandre Emsenhuber
eb5e031f31 * (bug 35303) Make proxy and DNS blacklist blocking work again 2012-03-18 22:19:00 +00:00
Aaron Schulz
0abb52ae76 Reverted r113177 per CR 2012-03-13 20:09:49 +00:00
Alexandre Emsenhuber
a7e20dd87f Move delcaration of User::$mAllowUsertalk out of the "cache variables" block since it's not part of it; also reorder the cache variables for consistency. 2012-03-13 19:03:59 +00:00
Alexandre Emsenhuber
8263743db1 Revert r113650 and reapply r113619 and r113649 with one modification: User::createNew() was missing a DatabaseBase::timestamp() call 2012-03-12 21:17:23 +00:00
Marcin Cieślak
f65f4456b2 Revert r113619, r113649: Breaks unit tests
https://integration.mediawiki.org/ci/job/MediaWiki-postgres-phpunit/3210/console

Maybe a new property with unpredictable
value breaks some tests. Need to investigate.
2012-03-12 19:58:27 +00:00
Marcin Cieślak
7a5ec916b4 Fix r113619: Convert timestamp to the backend database value 2012-03-12 19:35:38 +00:00
Alexandre Emsenhuber
91f9e6b721 Removed the remaining parts of "cookie password" stuff, does nothing and no longer used since ages 2012-03-12 14:04:20 +00:00
Alexandre Emsenhuber
b51076f9f7 Set the user_touched field directly when adding a new user to the database so that the field is correct when someone does not call saveSettings() after addToDatabase() 2012-03-12 13:07:50 +00:00
Alexandre Emsenhuber
21ac31f144 No need to do a database query when passing an IP address to User::idFromName() 2012-03-06 20:52:42 +00:00
Alexandre Emsenhuber
e6441b8f6c * Don't issue a write query to the database if the wl_notificationtimestamp is already null, so we don't to do at COMMIT et al. on every view request on an user watching the page
* Made WatchedItem select wl_notificationtimestamp instead of "1"
* Added loading mechanism, accessor to wl_notificationtimestamp and method to reset that timestamp
2012-02-10 19:35:14 +00:00
Sam Reed
c052fc3b7b Documentation followups from lastnight 2012-02-10 15:37:33 +00:00
Max Semenik
586503f33c (bug 28936, bug 5280) Broken or invalid titles can't be removed from watchlist. Now titles are fixed or deleted, if unfixable, upon loading Special:EditWatchlist. 2012-02-09 20:39:16 +00:00
Sam Reed
85bbb0b080 Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 18:01:10 +00:00
Sam Reed
f3cc77aaee Fixing some of the "@return true" or "@return false", need to be "@return bool" and then the metadata can say true if foo, false if bar
Other documentation improvements
2012-02-09 17:41:50 +00:00
Tim Starling
40469f56bd Fixed a bug in User::loadOptions(), probably introduced in r49925, causing the User::loadOptions() query to be done after a cache load if the user had no option overrides at the time of cache save. Store an empty array to the cache's mOptionOverrides instead of null. 2012-02-08 05:25:19 +00:00
Daniel Friesen
877ef150d3 (bug 34237) Regenerate an empty user_token and save to the database when we try to set the user's cookies for login.
This allows the entire user_token column to be regenerated after a leak by running `UPDATE user SET user_token = NULL;` and letting the user_tokens be regenerated as users try to log back in.
2012-02-07 08:07:28 +00:00
Chad Horohoe
f3a6fc1576 Revert r102624, r104262 (user display name stuff). Per CR there isn't consensus on this yet. 2012-01-11 00:53:08 +00:00
Niklas Laxström
b61f0adad9 r98539 - make a note of change in comments 2011-12-16 09:22:07 +00:00
Jeroen De Dauw
43f00eb80c follow up to r106393 - re-add these notices, since now they wont show for people that change the depr limit to see them 2011-12-16 00:24:00 +00:00
Antoine Musso
28cec38f86 Comment out wfDeprecated() call in User::getSkin(), there's over 300 uses in /trunk
reverts r106174
2011-12-14 13:00:30 +00:00
Antoine Musso
f731b9cb92 revert r106183 : type / not setting followup 2011-12-14 12:59:05 +00:00
Sam Reed
649d7f84d7 Comment out wfDeprecated() call in User::getSkin(), there's over 300 uses in /trunk
Follows up some (cba to find) rev
2011-12-14 12:54:35 +00:00
Raimond Spekking
409703b854 Self revert r106076 which was a revert of r106070. 2011-12-14 11:50:50 +00:00
Jeroen De Dauw
04b9a5d834 comment out another to soon placed warning 2011-12-13 21:37:19 +00:00
Raimond Spekking
dbd39d7b1e Partly revert r106070 for now: Flooding of translatewiki.net log/channel:
PHP Notice: Use of User::getSkin was deprecated in MediaWiki 1.18. [Called from TalkpageView::show in /www/w/extensions/LiquidThreads/pages/TalkpageView.php at line 251] in /www/w/includes/GlobalFunctions.php on line 3520
PHP Notice: Use of User::getSkin was deprecated in MediaWiki 1.18. [Called from MessageTable::contents in /www/w/extensions/Translate/utils/MessageTable.php at line 98] in /www/w/includes/GlobalFunctions.php on line 3520
PHP Notice: Use of User::getSkin was deprecated in MediaWiki 1.18. [Called from TranslationHelpers::ajaxEditLink in /www/w/extensions/Translate/utils/TranslationHelpers.php at line 1186] in /www/w/includes/GlobalFunctions.php on line 3520
PHP Notice: Use of User::getSkin was deprecated in MediaWiki 1.18. [Called from ThreadPermalinkView::getSubtitle in /www/w/extensions/LiquidThreads/pages/ThreadPermalinkView.php at line 153] in /www/w/includes/GlobalFunctions.php on line 3520
and maybe more
2011-12-13 20:10:30 +00:00
Jeroen De Dauw
0b105ebf1d added missing deprecation notices 2011-12-13 19:51:03 +00:00
Tim Starling
3da36a9103 Reverted r92364 (per-namespace permissions).
This is the wrong configuration format for such a feature, and the wrong interface. We already have certain per-namespace permissions in the Title class, and we didn't need to add extra formal parameters to a whole lot of User methods in order to get them. The feature should be implemented wholly in Title, and the concept of user rights should remain relatively simple and easy to understand, and independent of its many applications, i.e. a user either has a right or doesn't. Rights are just a tool for developing access policies; the complexity should be in the caller.

The revert was mostly done by hand, since there were a lot of conflicts. I tried to preserve the gist of conflicting changes in r102187 and r102873. The test changes are not simple reverts, rather I just edited out the per-namespace tests. I reverted the followups r92589 and r104310.
2011-12-12 06:03:01 +00:00
Sam Reed
b5f11fa813 * (bug 32960) remove EmailAuthenticationTimestamp from database when a
email address is removed

In Preferences::trySetUserEmail no point trying to reset the users email if it's the same

Same for User::setEmail

After setting the email though, invalidate email auth tokens
2011-12-11 15:31:17 +00:00
Sam Reed
361deca215 Fix whitespace 2011-12-06 15:38:51 +00:00
Sam Reed
ffbd299b04 Another artefact of the disable account merge
Remove disableaccount userright from core
2011-12-01 00:24:22 +00:00
Chad Horohoe
7914b2ee68 (bug 29475) Remove "trackback" feature entirely from core. This has been disabled-by-default since its inception and nobody uses it.
If someone really really wants this, they can write an extension.

Language files need rebuilding, but I took care of En and messages.inc.
2011-11-23 17:14:03 +00:00
Antoine Musso
61ef7cb305 User: document 2 returns 2011-11-23 15:53:03 +00:00
John Du Hart
aa6a4828af Followup r103294, remove a space that got added on the end of the method 2011-11-16 04:39:21 +00:00
John Du Hart
93e50f7eed Following r100264, update usages in core 2011-11-16 04:37:17 +00:00
Aaron Schulz
54e44e573a Removed transaction in saveOptions(). No reason was given for it and it could break any callers that have transactions. 2011-11-13 12:35:28 +00:00
Daniel Friesen
44ab4a9448 Add a new User::getDisplayName() to return the name that should be displayed in the interface.
Add a UserDisplayName hook to allow extensions to give custom display names for users.
Add a $wgRealNameInInterface to use the real name of a user as the display name.
To start of the first use of the display name functionality tweak SkinTemplate to declare the userdisplayname and use it inside of personal_urls.
2011-11-10 06:55:21 +00:00
Chad Horohoe
db97d8d85e Drop "selenium" user right. As far as I can tell, this isn't actually used anywhere (core or exts) and is leftover from the special page for selenium that was removed. 2011-11-09 17:01:09 +00:00
Roan Kattouw
698f9e9c00 Revert r101488, breaks parser test. Add a comment explaining why there is no caching currently being done, and document the fact that the hook is called a zillion times in hooks.txt 2011-11-01 16:25:26 +00:00
Roan Kattouw
42a360b069 Cache the result of User::getDefaultOptions(), so the UserGetDefaultOptions hook (introduced in r97365) is run only once rather than on every call. Discovered this issue after seeing an insane number of memcached fetches in my RL2 code, caused by a UserGetDefaultOptions hook accessing the Gadgets storage backend (which has a memc layer) and being called a zillion times due to this bug. 2011-11-01 15:55:57 +00:00
Aaron Schulz
5dfe3d6444 Revision objects now always use the current name of users, loading it on demand if necessary (e.g. when given a $row with no user_name but rev_user is not 0) 2011-10-21 23:20:52 +00:00