Commit graph

78 commits

Author SHA1 Message Date
Kunal Mehta
705cb9bb26 auth: Avoid deprecated wfGlobalCacheKey()
Change-Id: I2d6fa73fe857a0495df13aa25071e69b1ec2ba70
2017-05-23 15:10:17 -07:00
Kunal Mehta
0944b7d39c AuthManager: Avoid deprecated wfMemcKey()
Change-Id: I254f9c057b8a151c593054dd4f2137586abf262a
2017-05-23 15:01:34 -07:00
Fomafix
464f0c72a5 Remove multiple spaces in PHP files
Change-Id: Id9c26ec5ca730a9536f8fdccb8853eb03cbe87a4
2017-04-12 17:27:19 +02:00
Gergő Tisza
7dcefe4468 Demote "throttler data not found" logs to info level
Bug: T158364
Change-Id: I049c2d6da4720341ef2a380879ac19aff444b1d0
2017-02-17 00:59:07 +00:00
jenkins-bot
6124d71e25 Merge "Prevent login-only local password provider from removing passwords" 2016-11-30 16:39:12 +00:00
jenkins-bot
dcdb8e463e Merge "Bypass login page if no user input is required." 2016-11-24 22:59:42 +00:00
jenkins-bot
d6dcf23a8f Merge "Get ConfigFactory & MainConfig from MediaWikiServices" 2016-11-24 18:08:36 +00:00
addshore
b12086b618 Get ConfigFactory & MainConfig from MediaWikiServices
Change-Id: Iafdd7e00747060572463ffb05aae4543f3a06163
2016-11-23 00:12:38 +00:00
Brian Wolff
f12a3edff7 Remove passwordreset capture feature
If anyone wants such a thing, they can make their own extension.

I asked stewards, and they said they don't use this.

See also T32636 / 9de2bfd1fe

Bug: T150930
Change-Id: I3ab5962dba668e5d628e55ad0c0feae471d82b5e
2016-11-23 00:02:33 +00:00
Cindy Cicalese
f7cfed2a4a Bypass login page if no user input is required.
Bug: T141474
Bug: T110464
Change-Id: I9588a2b87a423f614fc5d2e771ad1ac7279ebd0b
2016-11-22 14:10:20 +00:00
jenkins-bot
3c108c8f46 Merge "Use different varname for upgraded hash from original hash" 2016-11-17 06:43:37 +00:00
Bryan Davis
a263b8d915 Throttler: improve log message compatibility with Monolog logger
The `type` log event attribute is used in Wikimedia production logging
to categorize log events by source (e.g. 'mediawiki', 'restbase', etc).
Adding a `type` key to the logging context overwrites the default value
of 'mediawiki'. Rename the key to `throttle` in the context and the
message template.

Change-Id: Ic274159774e43a8749f83c850fff7897956cf377
2016-11-15 22:37:04 +00:00
Gergő Tisza
6dbe9b2397 Prevent login-only local password provider from removing passwords
When the local password provider is in login-only mode, it should
disable itself as soon as some other primary provider is enabled.
It's impossible to tell whether that is the case though, so err in
the safer direction.

Change-Id: Ie77a9cc6d8f06aa52a893e753d9971e30b0f55e5
2016-11-15 07:27:57 +00:00
Brian Wolff
55c1a53cef Use different varname for upgraded hash from original hash
I found this confusing when reading the code. This should have
identical logic but slightly clearer.

Change-Id: I4918c29bd5dca3642de7bb60219fc246299d952d
2016-11-15 03:53:38 +00:00
jenkins-bot
12e2154a6b Merge "Add extra logging for when user logs in with a temp password" 2016-11-14 19:46:30 +00:00
Tim Starling
7a157e0bea Fix interpretation of "A-type" password hashes
An A-type hash is an unsalted hash. A B-type hash is a salted hash of
the form md5(salt "-" md5(password)). So it's not correct to have an
A-type hash with a salt. User::comparePasswords() and
CentralAuthUser::getPasswordFromString() already get this right, they
generate :B: prefixes for legacy salted hashes where the salt is not
specified in the database.

Change-Id: Icb809274f9f63641e54daf98332a5646fd58b550
2016-11-14 16:47:03 +11:00
Brian Wolff
eefbfa82ef Add extra logging for when user logs in with a temp password
It would be good to keep better track of this in the logs

Change-Id: I7f33b45f83034bfa1c003c149e92917b2f045988
2016-11-13 05:13:03 +00:00
Kunal Mehta
61adc1e146 Use namespaced ScopedCallback
The un-namespaced \ScopedCallback is deprecated.

Change-Id: Ie014d5a775ead66335a24acac9d339915884d1a4
2016-10-17 15:46:05 -07:00
Aaron Schulz
9a8c8ab98c Make TransactionProfiler::setSilenced() calls handle nesting
Change-Id: I6511a72a0fb921468a8a19ceb4d0a8ae669aa6e4
2016-10-12 18:14:03 -07:00
jenkins-bot
48df0714bb Merge "Avoid 'message' in log context in AuthManager" 2016-10-04 14:58:28 +00:00
Gergő Tisza
cdcc2a0e3f Avoid 'message' in log context in AuthManager
Logstash merges the log context into the main metadata (where
'message' is the log message) and ends up overwriting the message.

Bug: T145133
Change-Id: I27f221b0f1f7203e93d1b92119dc584ba8526f5b
2016-10-04 00:24:42 +00:00
jenkins-bot
51c8361872 Merge "Fix function name case" 2016-09-26 23:58:13 +00:00
Max Semenik
2b51bd1847 Fix function name case
Change-Id: Ibd4f682d2ed8500a50d85aae38f17281646f7c2d
2016-09-26 15:32:54 -07:00
jenkins-bot
20995c9635 Merge "AuthManager phpdoc cleanup" 2016-09-26 22:25:08 +00:00
Max Semenik
3b2a5a7c77 AuthManager phpdoc cleanup
Change-Id: Ib6fa897e76ae479de68acaeb16708c2bdf15ae5f
2016-09-26 13:59:41 -07:00
Aaron Schulz
8d59074c3b Avoid DB_MASTER use on password checks and defer password upgrades
Change-Id: Iceaafa31a5d8efcd9881b8a4a5c0e2aca1b1447c
2016-09-23 11:54:28 -07:00
cenarium
380ab62718 Support multiple limits and arbitrary periods in account creation throttle
This adds support for multiple count-per-period limits and arbitrary
period durations in the AuthManager account creation throttle in the
wiki settings. The $wgAccountCreationThrottle config variable becomes
an array like $wgPasswordAttemptThrottle.

Bug: T146290
Change-Id: Iea182a92a1199b0ce7103ab9ae24f1c87b01985c
2016-09-22 12:59:53 +02:00
jenkins-bot
f0d760a077 Merge "Show warnings in HTMLForm and warnings as warnings on Login/Signup form" 2016-09-17 18:05:13 +00:00
Florian
3706dcb5c7 Show warnings in HTMLForm and warnings as warnings on Login/Signup form
This commit changes the way how HTMLForm handles a Status object
when executed from a request. It now handles, beside the errors,
also the warnings of a Status object and prints them out, wrapped
in a warning box.

The LoginSignupPage uses this feature to show informative warnings
actually as warnings and not as more disturbing error messages.
Error messages should be reserved for errors and only for erros. An
AuthenticationProvider, which returns an UI AuthenticationResponse
can choose, if the given message is an error or a warning message.

This commit also addds a new function to Status, which allows a
developer to split the object into two new Status objects, where one only
contains the errors and the other only the warnings of the origin
Status object (splitByErrorType). StatusValue also has a new function,
splitByErrorType(), to support this.

Bug: T139179
Change-Id: I9a27911613e62b5c4cb86bea40696cb37c4f49c2
2016-09-17 16:33:39 +02:00
Aaron Schulz
a2790b1b80 Remove wfGetCaller() dependency from DatabaseBase
Change-Id: I3e240b2eb5c1f6a21f1bc974c3d28f5755c7451a
2016-09-15 14:40:00 -07:00
Gergő Tisza
4a92749554 Fix some PhpStorm warnings in AuthManager
Change-Id: Ib5fab7a54a6572897d9b679d6470d830cbb3cea9
2016-09-12 22:55:51 +00:00
Gergő Tisza
55572b08a6 Avoid user autocreation race condition caused by repeatable read
AuthManager tries to check whether the user already exists if
User::addToDatabase fails in autocreation, but since the same DB row
was already checked a few lines earlier and this method is typically
wrapped in an implicit transaction, it will just re-read the same
snapshot and not do anything useful. addToDatabase already has
a check for that so let's rely on that instead.

Bug: T145131
Change-Id: I94a5e8b851dcf994f5f9e773edf4e9153a4a3535
2016-09-08 17:14:15 -07:00
Aaron Schulz
950cf6016c Rename DB_SLAVE constant to DB_REPLICA
This is more consistent with LoadBalancer, modern, and inclusive
of master/master mysql, NDB cluster, and MariaDB galera cluster.

The old constant is an alias now.

Change-Id: I0b37299ecb439cc446ffbe8c341365d1eef45849
2016-09-05 22:55:53 -07:00
Aaron Schulz
16266edff3 Change "slave" => "replica DB" in /includes
Change-Id: Icb716219c9335ff8fa447b1733d04b71d9712bf9
2016-09-05 21:01:01 +00:00
jenkins-bot
80a372f957 Merge "Expand SessionManager / AuthManager documentation" 2016-08-30 19:11:13 +00:00
Gergő Tisza
94e2aa7b55 Expand SessionManager / AuthManager documentation
Bug: T110628
Bug: T142154
Change-Id: Ib0a41f01b3d12267b2a94ea1375e6d13cacd2b69
2016-08-30 18:54:30 +00:00
Aaron Schulz
9b273e8e49 Use DB_SLAVE in TemporaryPasswordPrimaryAuthenticationProvider
Barring ChronologyProtector failure (which itself falls back
to waitForReplication) on account creation, this should be fine.

Change-Id: I94be86c8f56e9e98a9d06814b33a9f08a9228db6
2016-08-29 15:53:37 +00:00
Gergő Tisza
97ad2ba55e Send registration welcome email post-commit
Follow-up to I8f1bd3e.

Change-Id: I26e7a1857363d4e6627a0f583a8556d0fd8ae623
2016-08-19 07:39:39 +00:00
jenkins-bot
d02d091047 Merge "Send new account and password reset emails post-commit" 2016-08-18 22:29:51 +00:00
jenkins-bot
8f2ccef7a7 Merge "AuthManager: Allow for flagging fields as "sensitive"" 2016-08-18 20:59:08 +00:00
Aaron Schulz
74516df106 Send new account and password reset emails post-commit
Change-Id: I8f1bd3e882e20fefa5ce0167202d511aa066cfe2
2016-08-18 13:23:33 -07:00
jenkins-bot
c039c6c6b9 Merge "Revert "AuthManager: Commit transaction after auto-creating a user"" 2016-08-18 20:16:47 +00:00
Brad Jorsch
83c98e7cd8 AuthManager: Allow for flagging fields as "sensitive"
This can allow AuthenticationRequests to flag certain fields as
sensitive, so e.g. the API can insist they be in the POST body rather
than in the query string.

Change-Id: I7b12aa4cd8f5a570f0df7213c0f9084b5a4d4de7
2016-08-18 19:36:29 +00:00
Aaron Schulz
5d20db748c Revert "AuthManager: Commit transaction after auto-creating a user"
* 81be9512a022 should obviate the main desire for this.
  The normal commit step is now relied upon again.
* 820f5d6ce5 and a26fbb6705 enforce DBO_TRX transactions.
* Committing the implicit transaction(s) prematurely is bad
  for web request and cross-DB transactionality. Only code
  that has clear outermost DB context (e.g. jobs/maintenance)
  should be doing things like this as it becomes hard to reason
  about (e.g. how much the request/caller needs atomicity
  or whether there is an outer (start|end)Atomic section).

This reverts commit 83c66caa08.

Change-Id: I1a5533b239e53f2089f239651c6fdf97e51c9062
2016-08-18 19:36:25 +00:00
Gergő Tisza
d4de10750f AuthManager: do not rewrite PRIMARY_REQUIRED to REQUIRED
AuthManager::getAuthenticationRequests() changes
AuthenticationRequest::$required from REQUIRED to PRIMARY_REQUIRED
if the request is from a primary; it made an exception when
all primary providers returned a given request. That exception is
not particularly useful (AuthenticationRequest::mergeFieldInfo()
used to rely on it to determine which fields are required, but
since I9d33bd2 that's not really needed), and knowing which request
is from a primary is useful for other means.

This changes required field semantics in a corner case: when a
primary provider returns two required requests, the previous
behavior was to assume that they are both required; the new one
is to treat them as alternatives (as if they were returned by
two different providers). So when all primary providers return
request X, and one of them returns Y in addition, the fields of X
will not be marked required, while previously that would have been
the case.

Instead of overcomplicating the interface for something that is
unlikely to come up in any real use case, add a new requirement
to PrimaryAuthenticationProvider that it should not return
multiple required requests.

Bug: T141471
Change-Id: I1c1f44d4d6b66f77c876e3459fb97f03483db744
2016-08-17 05:51:53 +00:00
Aaron Schulz
0d8c851d79 Make autoCreateUser() transaction profiler suppression limited in scope
Change-Id: If7b2330aa8cdf49ae25e5c0af5cb3ffc3f40b257
2016-08-15 14:10:33 -07:00
Gergő Tisza
854a462dc0 Remove $wgDisableAuthManager
Change-Id: I2b2c9693a275fcc026916bd97f303e7a5c8df341
2016-08-09 23:00:27 +00:00
Kunal Mehta
5c7bd77867 auth: Fix case of function call
Change-Id: I415a7f7ba2ea97515a110cd963ed96bb77ec7b97
2016-08-02 23:53:51 -07:00
jenkins-bot
d0e3551cda Merge "AuthManager: Break AuthPlugin::addUser more explicitly" 2016-07-14 21:08:53 +00:00
Brad Jorsch
83c66caa08 AuthManager: Commit transaction after auto-creating a user
As things stand now, DBO_TRX or DBO_DEFAULT will cause a transaction to
be started, and then anything in the entire request failing will
probably cause the newly-added user row to be lost. But updates to
external databases (e.g. CentralAuth) likely won't be since those DB
connections were probably shut down after the update was completed.

So let's explicitly commit changes af the end of auto-creation so that
problems with the request itself don't undo it.

Bug: T119736
Change-Id: I6c13c8feb86d8b9a01df894733c38445d048fea0
2016-07-12 13:35:10 -04:00