wiki.techinc.nl/tests/phpunit/includes
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
..
actions tests: don't assume wgLanguageCode is 'en' 2022-07-21 19:32:41 -04:00
api Merge "ApiTestCase: Drop testApiTestGroup forcing use of medium/large" 2022-08-29 13:49:16 +00:00
auth Fix block handling in CheckBlocksSecondaryAuthenticationProvider 2022-08-30 19:06:16 -07:00
block tests: Remove resetServiceForTesting after overrideConfigValues 2022-07-27 23:08:27 +02:00
cache Inline a few more trivial createMock() calls in tests 2022-08-08 09:50:50 +02:00
changes tests: Migrate setMwGlobals() to overrideConfigValue(s)() 2022-07-23 05:53:49 +01:00
changetags tests: Migrate setMwGlobals() to overrideConfigValue(s)() 2022-07-23 05:53:49 +01:00
collation IcuCollation: Remove unnecessary rtrim() and unset() 2022-05-21 02:02:39 -04:00
config Clean up tests that misused the parameters of assertSame/Equals 2022-02-08 07:21:10 +00:00
content Customise error message for invalid JSON, add hook 2022-08-26 01:22:10 +05:30
context Revert "Setup: Promote clearActionName log message to runtime warning" 2022-07-12 10:17:59 +00:00
db rdbms: remove getTopologyRootPrimary() and clean up related fields/parameters 2022-08-26 12:26:10 -07:00
debug tests: Migrate setMwGlobals() to overrideConfigValue(s)() 2022-07-23 05:53:49 +01:00
deferred tests: Migrate setMwGlobals() to overrideConfigValue(s)() 2022-07-23 05:53:49 +01:00
diff tests: Migrate setMwGlobals() to overrideConfigValue(s)() 2022-07-23 05:53:49 +01:00
editpage tests: Migrate setMwGlobals() to overrideConfigValue(s) 2022-07-27 18:07:00 +01:00
exception tests: Migrate away from setMwGlobals() 2022-08-22 20:17:49 +00:00
externalstore Use ::class to refer to class names 2022-08-17 22:59:17 +02:00
filebackend tests: Migrate away from setMwGlobals() 2022-08-22 20:17:49 +00:00
filerepo tests: Migrate setMwGlobals() to overrideConfigValue(s) 2022-07-27 18:07:00 +01:00
GlobalFunctions tests: Migrate setMwGlobals() to overrideConfigValue(s) 2022-07-27 18:07:00 +01:00
HookContainer phpunit: use ->getServiceContainer() in integration tests 2022-01-27 22:04:16 +01:00
htmlform tests: Use Title::makeTitle instead of Title::newFromText 2022-07-06 00:44:00 +02:00
http Migrate usage of setMwGlobals() to overrideConfigValue(s) 2022-08-01 06:16:22 +01:00
import Migrate usage of setMwGlobals() to overrideConfigValue(s) 2022-08-01 06:16:22 +01:00
installer Replace trivial usa of mock builder with createMock() shortcut 2022-07-15 16:43:48 +00:00
interwiki Migrate usage of setMwGlobals() to overrideConfigValue(s) 2022-08-01 06:16:22 +01:00
jobqueue Replace trivial usages of code in strings with concatenation 2022-08-26 12:26:44 +00:00
language Migrate usage of setMwGlobals() to overrideConfigValue(s) 2022-08-01 06:16:22 +01:00
languages Use yield consistently in grammar tests 2022-06-03 14:52:53 +03:00
libs Do not compare byte-for-byte of serialized items in tests [php8.1] 2022-08-24 07:06:06 +00:00
linkeddata Migrate usage of setMwGlobals() to overrideConfigValue(s) 2022-08-01 06:16:22 +01:00
linker tests: Add missing @group Database 2022-08-06 22:55:12 +02:00
logging tests: Migrate MediaWiki settings to overrideConfig...() 2022-08-18 17:48:03 +01:00
mail tests: Add missing @group Database 2022-08-06 22:55:12 +02:00
media Migrate usage of setMwGlobals() to overrideConfigValue(s) 2022-08-01 06:16:22 +01:00
Message Add Message/MessageValue user group member parameter type 2021-11-16 11:24:35 -05:00
Navigation tests: don't assume wgLanguageCode is 'en' 2022-07-21 19:32:41 -04:00
objectcache SqlBagOStuff: Fix modtoken comparison 2022-08-19 11:11:58 +10:00
page Merge "Inline a few more trivial createMock() calls in tests" 2022-08-11 23:23:47 +00:00
pager Replace trivial usa of mock builder with createMock() shortcut 2022-07-15 16:43:48 +00:00
ParamValidator/TypeDef tests: Add missing @group Database 2022-08-06 22:55:12 +02:00
parser Add markup to page titles to distinguish the namespace and the main text 2022-08-16 23:36:21 +00:00
password Add convenience methods for asserting status. 2022-03-16 22:44:25 +01:00
Permissions tests: Remove resetServiceForTesting after overrideConfigValues 2022-07-27 23:08:27 +02:00
poolcounter Replace deprecated calls ParserOptions::newCanonical( 'canonical' ) 2022-06-16 14:22:24 +01:00
preferences Replace usage of User::getOption 2022-08-19 21:21:36 +02:00
rcfeed Migrate from setMwGlobals() to overrideConfigValue(s) 2022-08-02 10:14:10 +01:00
registration Collect autoloader info in ExtensionProcessor 2022-06-07 17:39:00 +02:00
ResourceLoader ResourceLoaderSkinModule: Split up interface feature into multiple parts 2022-08-24 13:59:17 +00:00
Rest REST: introduce getPrivateRouteUrl 2022-07-14 13:12:35 +00:00
Revision rdbms: remove getTopologyRootPrimary() and clean up related fields/parameters 2022-08-26 12:26:10 -07:00
search Migrate use of global to use of config settings 2022-08-12 12:25:17 +00:00
session Merge "Replace trivial usages of code in strings with concatenation" 2022-08-26 16:54:56 +00:00
shell Migrate use of global to use of config settings 2022-08-12 12:25:17 +00:00
site Migrate use of global to use of config settings 2022-08-12 12:25:17 +00:00
skins Migrate use of global to use of config settings 2022-08-12 12:25:17 +00:00
sparql Replace trivial usa of mock builder with createMock() shortcut 2022-07-15 16:43:48 +00:00
specialpage Migrate use of global to use of config settings 2022-08-12 12:25:17 +00:00
specials Avoid PHP 8.1 failures in SpecialPreferencesTest::testT43337 2022-08-29 22:37:22 +00:00
Storage Replace usage of User::getOption 2022-08-19 21:21:36 +02:00
title tests: Migrate away from setMwGlobals() to overrideConfigValue(s)() 2022-08-14 22:23:25 +01:00
upload tests: Migrate away from setMwGlobals() to overrideConfigValue(s)() 2022-08-14 22:23:25 +01:00
user tests: Migrate away from setMwGlobals() to overrideConfigValue(s)() 2022-08-14 22:23:25 +01:00
utils tests: Migrate away from setMwGlobals() to overrideConfigValue(s)() 2022-08-14 22:23:25 +01:00
watcheditem tests: Migrate away from setMwGlobals() to overrideConfigValue(s)() 2022-08-14 22:23:25 +01:00
ActorMigrationTest.php tests: Use namespaced IDatabase class 2022-05-28 00:09:55 +02:00
ActorMigrationTest.sql Schema migration for revison_actor_temp table removal 2021-07-14 08:29:04 +10:00
AutoLoaderTest.php tests: Use overrideConfigValue(s) where necessary 2022-07-16 23:45:52 +01:00
CategoryTest.php tests: Use overrideConfigValue(s) where necessary 2022-07-16 23:45:52 +01:00
CommentStoreCommentTest.php
CommentStoreTest.php tests: Change use of AtEase to at operator 2022-02-24 21:29:51 +00:00
CommentStoreTest.sql
ContentSecurityPolicyTest.php [php8.1] Change override of $wgResourceBasePath for CSP tests 2022-07-25 12:54:04 -07:00
EditPageConstraintsTest.php Merge "EditPage: Disentangle edit summary and section title" 2022-07-19 21:14:32 +00:00
EditPageTest.php tests: Use overrideConfigValue(s) where necessary 2022-07-16 23:45:52 +01:00
ExportTest.php tests: Use overrideConfigValue(s) where necessary 2022-07-16 23:45:52 +01:00
ExtraParserTest.php tests: Remove resetServiceForTesting after overrideConfigValues 2022-07-27 23:08:27 +02:00
FauxRequestTest.php tests: Use overrideConfigValue(s) where necessary 2022-07-16 23:45:52 +01:00
GitInfoTest.php tests: Use overrideConfigValue(s) where necessary 2022-07-16 23:45:52 +01:00
HooksTest.php phpunit: use ->getServiceContainer() in integration tests 2022-01-27 22:04:16 +01:00
HtmlTest.php tests: Use overrideConfigValue(s) where necessary 2022-07-16 23:45:52 +01:00
LinkerTest.php tests: Migrate MediaWiki settings to overrideConfig...() 2022-08-18 17:48:03 +01:00
LinkFilterTest.php tests: Use overrideConfigValue(s) where necessary 2022-07-16 23:45:52 +01:00
MagicWordFactoryTest.php tests: Change use of AtEase to at operator 2022-02-24 21:29:51 +00:00
MediaWikiServicesTest.php Replace trivial usa of mock builder with createMock() shortcut 2022-07-15 16:43:48 +00:00
MediaWikiTest.php tests: don't assume wgLanguageCode is 'en' 2022-07-21 19:32:41 -04:00
MediaWikiVersionFetcherTest.php
MergeHistoryTest.php tests: Use overrideConfigValue(s) where necessary 2022-07-16 23:45:52 +01:00
MessageTest.php tests: Use overrideConfigValue(s) where necessary 2022-07-16 23:45:52 +01:00
MockServiceWiring.php
MovePageTest.php Tests: Use createNoOpMock() shortcut in a few more places 2022-07-18 21:25:31 +00:00
MultiHttpClientTest.php Replace trivial usa of mock builder with createMock() shortcut 2022-07-15 16:43:48 +00:00
MWTimestampTest.php tests: Use overrideConfigValue(s) where necessary 2022-07-16 23:45:52 +01:00
OutputPageTest.php tests: Migrate MediaWiki settings to overrideConfig...() 2022-08-18 17:48:03 +01:00
PagePropsTest.php Hard deprecate PageProps::getInstance() 2022-03-15 22:58:48 +01:00
SampleTest.php tests: Use overrideConfigValue(s) where necessary 2022-07-16 23:45:52 +01:00
SiteStatsTest.php Replace deprecated JobQueueGroup::singleton() 2022-01-27 21:37:50 +01:00
StatusTest.php StatusValue: include type in toString output 2022-06-10 11:09:14 +00:00
TemplateCategoriesTest.php tests: Make sure deferred updates are done and re-enable TemplateCategoriesTest 2022-03-17 13:01:08 +00:00
TestUser.php tests/api: Add TestUser::getAuthority and use it 2022-08-06 23:15:27 +02:00
TestUserRegistry.php
TimeAdjustTest.php tests: Use overrideConfigValue(s) where necessary 2022-07-16 23:45:52 +01:00
TitleTest.php Replace complicated setup with createNoOpMock() in TitleTest 2022-08-06 09:19:48 +00:00
TitleUrlTest.php tests: Use overrideConfig(Value|Values) where needed 2022-07-12 22:24:50 +00:00
TrackingCategoriesTest.php Move ::addTrackingCategory() implementation to TrackingCategories 2021-10-15 14:17:58 -04:00
WebRequestTest.php Support CDN query parameter re-ordering 2022-08-09 01:53:38 +00:00
WikiMapTest.php tests: Migrate MediaWiki settings to overrideConfig...() 2022-08-18 17:48:03 +01:00
XmlTest.php tests: don't assume wgLanguageCode is 'en' 2022-07-21 19:32:41 -04:00