Commit graph

1154 commits

Author SHA1 Message Date
Legoktm
4c528691e1 Revert "Add 'AuthPluginStrict' log to identify users who are unable to authenticate"
Does not work as it will also log failed login attempts due
to a wrong password.

This reverts commit 9a97a7530f.

Change-Id: I6abd19da4e6939315a7fe6f7debe5227b68d38a7
2015-07-13 23:07:02 +00:00
Kunal Mehta
9a97a7530f Add 'AuthPluginStrict' log to identify users who are unable to authenticate
To be able to identify any users who are unable to log in when switching
from allowing local authentication to strict.

Change-Id: I2ebdccdad9c7794d1c1b13db6a646a43bc770c4e
2015-07-13 17:37:35 +00:00
jenkins-bot
05fce41bb7 Merge "Made the prior user existence check in LoginForm use DB_MASTER" 2015-07-11 00:37:31 +00:00
Aaron Schulz
e0ee2cdc4b Fixed bitfield check in User::loadFromId()
* READ_LOCKING is a composite field, so it can yeild 00, 01,
  10, or 11 for the relevant two bits. Only one of them should
  pass the check to avoid locking and snapshot breaking queries
  for no reason.

Change-Id: Ief04ac20c7639fcf79443a3ee39a471542a59551
2015-07-10 16:52:28 -07:00
Aaron Schulz
08698e48e8 Made the prior user existence check in LoginForm use DB_MASTER
* This helps if multiple account creation attempts were made in a row
  and the slave selected was lagged (either too much for Chronology
  Protector or the user did not resend the cookies to link the session).
* The locking also better handles concurrent attempt to make another
  account, especially with CentralAuth trying to make external accounts.
  This assumes that the rate of concurrent account creations with close
  names is low enough given trx speed to avoid gap locking issues. This
  will need to be confirmed with low error log rates to be sure.
* The User::idFromName() method now includes a $flags parameter.

Bug: T104615
Change-Id: I8385526a19efc528a016ad2bbf376b377138966b
2015-07-10 16:45:28 -07:00
Aaron Schulz
84758e6f10 Made WANObjectCache::getCheckKey() automatically init the key
* This still allows If-Modified-Since logic but does not
  need to broadcast initialization values just because a
  key fell out of cache. The value can differ between DCs
  anyway via skew, this just lets them drift more. Actual
  purge events are still broadcasted, which is what matters.
* The User class has now been simplified given this change.
* Added more general comments to getCheckKeyTime().

Change-Id: Ic1f4bbb1947e0d1dd47499c9e9dc86991c30580c
2015-07-02 07:13:22 +00:00
jenkins-bot
b42a5e851c Merge "Replace some MWException usage in User" 2015-07-01 04:19:14 +00:00
Aaron Schulz
35fb85ba0b Replace some MWException usage in User
Change-Id: I61dbd6223354530311c497ad0f45ed49a573d0cb
2015-06-30 21:07:48 -07:00
Aaron Schulz
0aa93ad8b8 Made User::loadFromId() use READ_NORMAL by default
* This covers CentralAuthHooks::onUserLoadFromSession()
  among other cases (OAuth user loading, ect).

Bug: T92357
Change-Id: I9c90027d8852ff8c1d626c03b5dbd765b95b0ce1
2015-06-25 20:16:55 +00:00
Sam Smith
16cea35d85 Configure logged in session length independently
* Add the $wgExtendedLoginCookies configuration variable, which defines
  the set of login cookies that can have their lifetime configured
  independently
* Add the $wgExtendedLoginCookieExpiration configuration variable, which
  dictates when the extended lifetime login cookies expire
* Default $wgExtendedLoginCookieExpiration to null so that the current
  behaviour is unaffected

Bug: T68699
Change-Id: I0cc24524e4d7d9d1d21c9fa8a28c7c76b677b96c
2015-06-23 19:31:20 -04:00
Aaron Schulz
dd42294d29 Made User generally use DB_SLAVE by default
* By default, users will load from the slave unless
  the thread did a recent DB write. This is to handle
  changes within a request.
* ChronologyProtector should avoid staleness in common
  cases, and the CAS check on user_touched is a final
  barrier to block stale user object updates.
* Note that passwords are not cached, so they hit the
  DB when ever needed. Passwords now load from slaves
  when possible, instead of the master.
* This should get the code closer to handling user
  login and logged in users when the master is down.
* Fixed loadFromId() when READ_LOCKING is used.
* Also addressed TODO comment in load().

Bug: T92357
Change-Id: I0a8bdab720c19fe3fc2381799ae2e90ff09bb4cf
2015-06-16 08:29:06 -07:00
jenkins-bot
9ce9ca079f Merge "Password validity by policy per group" 2015-06-10 17:46:20 +00:00
csteipp
1a20dc9362 Password validity by policy per group
Make password policies defined in a configurable policy, which is
defined by group. A user's password policy will be the maximum of
each group policy that the user belongs to.

Bug: T94774
Change-Id: Iad8e49ffcffed38df6293db0ef31a227d3962003
2015-06-10 10:34:17 -07:00
Aaron Schulz
fd5bde60ec Fixed "wfTimestamp() fed bogus time value" errors
* This broke OutputPage::checkLastModified() as the touched time was false

Change-Id: I118d3ddf07c7b69ad269f3aee0c70ab4159df192
2015-06-09 18:47:49 -07:00
jenkins-bot
6378a12c88 Merge "Made User::touch no longer call load()" 2015-06-03 07:47:00 +00:00
Aaron Schulz
5399fba68b Use less fuzzy User::getDBTouched() in ApiStashEdit::getStashKey()
* The getTouched() value can bump more often or vary in DCs

Change-Id: Idffa22c9dde7c7950943b104ed61f5779636b7e7
2015-06-02 20:31:14 +00:00
Aaron Schulz
833bdbab37 Fixed $flags bit operation precedence fail in User::loadFromDatabase()
* The bug made READ_LATEST also act as READ_LOCKING

Bug: T100577
Bug: T100869
Bug: T98706
Change-Id: I85092970c236fc4482371216b9f6592c49a27942
2015-06-02 18:39:37 +00:00
Aaron Schulz
5b2670b31b Made User::touch no longer call load()
* Just reset mQuickTouched instead of guessing a new value
  in touch() for simplicity

Change-Id: Ibfe551cf061919ab18c4ff634d8db8f3c0eaf0a5
2015-06-02 17:24:48 +00:00
Ori Livneh
05aac977eb User::clearSharedCache: don't load the full user record for just the ID
Rather than call $this->load() unconditionally, get just the ID via
$this->getId(), potentially saving us a database lookup.

Change-Id: Ifa3b96956a1d66d3e877573ff01970758fad8790
2015-05-19 15:45:46 -07:00
jenkins-bot
d1150378f1 Merge "Converted User object cache to the WAN cache" 2015-05-18 06:38:06 +00:00
jenkins-bot
fe5c31a59b Merge "Converted User touched key to using the WAN cache" 2015-05-11 16:52:48 +00:00
jenkins-bot
d892c0f86f Merge "Made wl_notificationtimestamp updates able to use queues" 2015-05-04 18:35:45 +00:00
Aaron Schulz
b614290f73 Converted User object cache to the WAN cache
Bug: T93141
Change-Id: I93dc5367d85d661bd5bdce29f4665bb8cd21ba02
2015-04-30 01:30:06 +00:00
Aaron Schulz
4a8da41079 Converted User touched key to using the WAN cache
Bug: T93141
Change-Id: Id5478d3007bde3f621b4c3ffe9950a654e0ac30a
2015-04-30 01:30:00 +00:00
Aaron Schulz
76f961097a Remove cache use in setNewtalk, as nothing reads from that
Change-Id: Ia094fa99be49816b48e35aeb695b5d9558fd1d28
2015-04-27 16:45:58 -07:00
Aaron Schulz
836ad263c3 Made wl_notificationtimestamp updates able to use queues
* This adds a wgActivityUpdatesUseJobQueue setting, which lets
  these updates work via the job queue, rather than direct DB
  master updates.

Bug: T91284
Change-Id: Ie60e20162fd833e64d81763a6aa1dc3faf2162f3
2015-04-25 14:47:42 -07:00
jenkins-bot
786a37c577 Merge "Added CAS logic to User::addAutopromoteOnceGroups" 2015-04-21 15:43:54 +00:00
Aaron Schulz
8c5406a437 Added CAS logic to User::addAutopromoteOnceGroups
* This should avoid duplicate logging events on races or when
  the cache fails to update.
* Also added getDBTouched() method to get user_touched itself.

Bug: T48834
Change-Id: Ib2cd0a2c72629fa4e13dcff4d2d6fbac8e690b32
2015-04-16 13:31:40 -07:00
Aaron Schulz
28404fad36 Made saveSettings() CAS check handle caught DB exceptions better
Change-Id: I8e9e75af437e00a76e4184908c579a6702c9023a
2015-04-16 10:54:45 -07:00
Aaron Schulz
9e50d6e999 Try to reduce stale cache updates in User::saveSettings()
Bug: T95839
Change-Id: I4dc87697448b833ea575cbb3e05c92c7160d03f9
2015-04-15 20:34:51 -07:00
Aaron Schulz
eccd9707a8 Tweaked CAS log message for User::saveSettings
Change-Id: I82376561b3c7c15da6fe6374db0245caa5d79ce8
2015-04-15 17:58:48 -07:00
This, that and the other
ae3ab9eef0 Allow users to add, remove and apply change tags using the API
You can add tags at the same time as performing action=edit, as long as you
have the "applychangetags" right. Also, you can add or remove tags after
the fact from revisions and log entries using the API action=tags.

No UI is provided for either of these changes. The target audience is user
scripts, gadgets and similar tools.

Includes a new log parameter format type: "list", for a comma-separated
list of values.

Logging of change tag events is limited to those that do not accompany an
edit (i.e. those done after the fact), and is hidden from Special:Log by
default, similar to the patrol log.

Bug: T20670
Change-Id: I37275e0f73fa3127f55da0c320b892551b61ee80
2015-04-15 18:30:45 +00:00
Aaron Schulz
7eb982b0b4 Avoid deadlocks in User::incEditCount
* This makes concurrent editing less problematic

Change-Id: I930222d5e831bb3729194abbdcb3cab194c70494
2015-04-14 04:59:44 +00:00
Aaron Schulz
5b4bd16327 Made User::invalidateCache() use touch() instead of the DB query
* This method is used for clearing the User cache as well
  as bumping the value of getTouched() for HTTP 304 logic.
  These do not need to do the actual user_touched update.
* This also avoids problems with setting mTouched but
  deferring the update. That confused the CAS update
  logic since it expects mTouched to be in the DB.

Change-Id: I96b30f5c9c8b4714e6663b187f741954a13312cf
2015-04-07 19:59:35 -07:00
Aaron Schulz
eb9a75cff6 Made User::loadPasswords respect "queryFlagsUsed"
* Also cleaned up a few var names

Change-Id: I3a835e3980dfc3205716cf5bb1a4c04aa037f36d
2015-04-07 12:12:23 -07:00
jenkins-bot
7253056a23 Merge "Added CAS-style logic to User::saveSettings as a final sanity check" 2015-04-07 15:43:43 +00:00
jenkins-bot
4b983308cb Merge "Log when User::saveSettings is called in read-only mode" 2015-04-07 09:44:59 +00:00
Aaron Schulz
f6b76d3a9e Added CAS-style logic to User::saveSettings as a final sanity check
* This should prevent lag or race conditions from rolling back data

Change-Id: I5e70975f4e4010fea7af0801bc11dda887df55f4
2015-04-06 12:20:05 -07:00
Aaron Schulz
6af07cbe1f Log when User::saveSettings is called in read-only mode
Change-Id: I56a1760f2e6bbda889590777b553a8dfda587590
2015-04-06 11:26:42 -07:00
Aaron Schulz
b84d573d4b Made User::newTouchedTimestamp handle clock skew a bit better
* This does not handle race conditions, but is a prelude to using CAS
  style logic on save using the timestamp.

Change-Id: I9c31c272fcf77b686764b7c3a6a32ac29576347c
2015-04-06 11:14:48 -07:00
Aaron Schulz
f7fe3c2b46 Added read-only checks around User::saveSettings where they belong
* Ideally saveSettings() would not just silently do nothing in
  read-only mode as not all callers expect that behavior. This
  change is just the first step.

Change-Id: Ieeaf531dac3027ddba89c60159b98f9c04de78d3
2015-04-02 18:12:37 +00:00
Tyler Romeo
63cf33d825 SECURITY: Set maximal password length for DoS
Prevent DoS attacks caused by the amount of time
it takes to hash long passwords by setting a limit
on password length.

Slightly restructures the behavior of User::checkPasswordValidity
in order to accommodate for the difference between
passwords the user should be able to log in with and
passwords they should not.

Bug: T64685
Change-Id: I24f33474c6f934fb8d94bb054dc23093abfebd5e
2015-04-01 09:55:42 -07:00
jenkins-bot
eca8322266 Merge "Removed unused parameter from User::checkNewtalk" 2015-03-30 18:31:55 +00:00
Aaron Schulz
4f8dc27b90 Removed unused parameter from User::checkNewtalk
Change-Id: I112fc32d9985664ab5edea842f52f62554c082ea
2015-03-30 11:15:01 -07:00
Aaron Schulz
ab24e5d417 Made User::getFormerGroups load properly
Change-Id: I5c752f9446ef78f08c457e9758ebf9e0b79a0c37
2015-03-30 11:13:46 -07:00
Aaron Schulz
cdc572c767 Made User::validateCache account for mQuickTouched
Change-Id: I3b733a0221462350f3a24d54ffe814357f379512
2015-03-30 09:36:49 -07:00
jenkins-bot
f9a5c17799 Merge "Made user preferences load from the master by default" 2015-03-30 15:30:49 +00:00
Aaron Schulz
f68da5b863 Made User actually use the mQuickTouched process cache
Change-Id: I158eae2dac16b5fdacd095fff7fb031b42804a1e
2015-03-26 22:51:13 -07:00
Aaron Schulz
7e27652a76 Made user preferences load from the master by default
* Warn when saving slave-loaded data in saveSettings()
* Respect the loading $flags for preferences/groups
* Fixed use of flags in addToDatabase()
* Made loadFromCache() protected to make this mess easier
  to reason about (no callers found)
* Added some doc comments

Bug: T92232
Change-Id: Ic1dd66063cc2f98fc03861df1c523981f846a0be
2015-03-26 19:18:44 -07:00
jenkins-bot
ddfcbf86cc Merge "Made addAutopromoteOnceGroups check wfReadOnly" 2015-03-26 22:37:59 +00:00