wiki.techinc.nl/includes/auth
Gergő Tisza 04bdfa50f0
Fix block handling in CheckBlocksSecondaryAuthenticationProvider
The authentication provider's testUserForCreation() method is for
checking whether a given user name is available. The current
user being IP-blocked has nothing to do with that username's
availability so stop checking that. (AuthManager will check it
via AuthManager::authorizeCreateAccount() elsewhere. Although
that method doesn't seem to be doing anything useful and could
probably just be replaced with a direct call to
PermissionManager, but that's left for a separate, less risky
patch.)

Special-case autocreation though, which doesn't use
the more appropiate AuthManager::authorizeCreateAccount() for
performance reasons so it does need an IP block check.
(At least I think it is for performance reasons. Maybe it's
just an unintentional omission, and that should be used instead?)

While we are at it, also fix a TODO in AuthManager where partial
blocks were taken into account for $wgBlockDisablesLogin, and
clarify in the config schema that they aren't, improve some
comments to make it more obvious why some things are/aren't
done in CheckBlocksSecondaryAuthenticationProvider, and make
the logic more similar to the one in testUserForCreation().

Functional changes:
* Partial blocks are ignored for authentication, account
  creation and autocreation.
* On $wgBlockDisablesLogin wikis IP blocks won't prevent
  login anymore.
* On $wgBlockDisablesLogin wikis, blocks will now prevent
  account autocreation even if they are not configured to
  prevent account creation. The assumption is that on such
  wikis account creation is restricted via some means.
  This probably isn't necessary as blocks should also prevent
  the conditions needed for autocreation (e.g. log the user
  out centrally), but can serve as defense in depth.
  Along with the special-casing of autocreation, this means
  on such wikis any IP block will prevent autocreation, which
  is not great but seems not worth even more code complexity
  to avoid.
* The action=query&list=users&usprop=cancreate API won't take
  blocks into account anymore.

Bug: T306018
Bug: T208895
Change-Id: Ie94d61640301192b287275311f3452e606469d25
2022-08-30 19:06:16 -07:00
..
Hook auth: Improve documentation on LocalUserCreatedHook 2022-06-01 21:12:32 +02:00
AbstractAuthenticationProvider.php build: Updating dependencies 2021-07-22 03:36:05 +00:00
AbstractPasswordPrimaryAuthenticationProvider.php Use MainConfigNames instead of string literals, #3 2022-04-26 14:31:26 +03:00
AbstractPreAuthenticationProvider.php Merge "Replace "@stable for subclassing" with "@stable to extend"" 2020-07-13 09:31:38 +00:00
AbstractPrimaryAuthenticationProvider.php Using @return never documentation on always-throw-function 2021-09-07 17:29:03 +02:00
AbstractSecondaryAuthenticationProvider.php Merge "Replace "@stable for subclassing" with "@stable to extend"" 2020-07-13 09:31:38 +00:00
AuthenticationProvider.php Implement injecting of dependencies to an AuthenticationProvider 2021-04-26 15:17:34 +03:00
AuthenticationRequest.php phan: Remove PhanTypePossiblyInvalidDimOffset suppression 2022-03-28 23:26:49 +02:00
AuthenticationResponse.php Allow AuthenticationResponse to store private failure reasons 2022-05-14 20:41:51 +01:00
AuthManager.php auth: Introduce quick permissions checks for AuthManager 2022-06-01 08:06:21 +01:00
ButtonAuthenticationRequest.php phan: Disable scalar_implicit_cast setting 2022-03-18 18:52:24 +00:00
CheckBlocksSecondaryAuthenticationProvider.php Fix block handling in CheckBlocksSecondaryAuthenticationProvider 2022-08-30 19:06:16 -07:00
ConfirmLinkAuthenticationRequest.php Merge "Replace "@stable for subclassing" with "@stable to extend"" 2020-07-13 09:31:38 +00:00
ConfirmLinkSecondaryAuthenticationProvider.php
CreatedAccountAuthenticationRequest.php Merge "Replace "@stable for subclassing" with "@stable to extend"" 2020-07-13 09:31:38 +00:00
CreateFromLoginAuthenticationRequest.php Merge "Replace "@stable for subclassing" with "@stable to extend"" 2020-07-13 09:31:38 +00:00
CreationReasonAuthenticationRequest.php Merge "Replace "@stable for subclassing" with "@stable to extend"" 2020-07-13 09:31:38 +00:00
EmailNotificationSecondaryAuthenticationProvider.php Use MainConfigNames instead of string literals, #3 2022-04-26 14:31:26 +03:00
LocalPasswordPrimaryAuthenticationProvider.php Use MainConfigNames instead of string literals, #3 2022-04-26 14:31:26 +03:00
PasswordAuthenticationRequest.php Merge "Replace "@stable for subclassing" with "@stable to extend"" 2020-07-13 09:31:38 +00:00
PasswordDomainAuthenticationRequest.php Merge "Replace "@stable for subclassing" with "@stable to extend"" 2020-07-13 09:31:38 +00:00
PreAuthenticationProvider.php
PrimaryAuthenticationProvider.php Fix numerous PSR12.Properties.ConstantVisibility.NotFound 2020-05-11 01:59:00 +00:00
RememberMeAuthenticationRequest.php Fix many typos in comments 2022-05-10 12:46:11 +00:00
ResetPasswordSecondaryAuthenticationProvider.php auth: Use phan templates for getRequestByClass 2019-09-08 15:44:46 +00:00
SecondaryAuthenticationProvider.php
TemporaryPasswordAuthenticationRequest.php Use MainConfigNames instead of string literals 2022-04-11 17:53:27 +03:00
TemporaryPasswordPrimaryAuthenticationProvider.php Fix many typos in comments 2022-05-10 12:46:11 +00:00
ThrottlePreAuthenticationProvider.php Use MainConfigNames instead of string literals 2022-04-11 17:53:27 +03:00
Throttler.php Use MainConfigNames instead of string literals 2022-04-11 17:53:27 +03:00
UserDataAuthenticationRequest.php Use MainConfigNames instead of string literals 2022-04-11 17:53:27 +03:00
UsernameAuthenticationRequest.php Merge "Replace "@stable for subclassing" with "@stable to extend"" 2020-07-13 09:31:38 +00:00