Page MenuHomePhabricator

Remove $wgCheckUserGroupRequirements and related code
Closed, ResolvedPublic

Description

Background

The CheckUser config $wgCheckUserGroupRequirements and the core hook SpecialUserRightsChangeableGroups were added in T393615: Impose technical restrictions on granting the `temporary-account-viewer` group as a quick way to enforce group requirements.

Following T409717: Configure temporary-account-viewer group to use RestrictedGroups config, these are no longer needed, so they should be removed.

Acceptance criteria
  • Remove $wgCheckUserGroupRequirements, SpecialUserRightsChangeableGroups and related code

Event Timeline

Do we want to deprecate CheckUserGroupRequirements et al in any way? Or just remove it wholesale as part of the 1.46 cycle?

Looks like it was added in rECHU46a3c65e82d5: Enforce requirements for temporary-account-viewer group under T393615: Impose technical restrictions on granting the `temporary-account-viewer` group.

Is it worth preventing it shipping in MW-1.45-release too? Obviously we wouldn't be backporting all the changes to add the "same" functionality to MW core and CentralAuth etc.

But if we never ship it in a release, it's never considered stable sooooo....

Looks like it was added in rECHU46a3c65e82d5: Enforce requirements for temporary-account-viewer group under T393615: Impose technical restrictions on granting the `temporary-account-viewer` group.

Is it worth preventing it shipping in MW-1.45-release too? Obviously we wouldn't be backporting all the changes to add the "same" functionality to MW core and CentralAuth etc.

But if we never ship it in a release, it's never considered stable sooooo....

Could it be marked as unstable in the MW-1.45-release? It would avoid the need to drop the functionality entirely in a release, but makes it clear that in a future wiki version it will no longer exist. IMO I would expect that WMF wikis will be the only users of this feature as it stands in CheckUser.

Yeah, I'd presume no one else is likely to use it, or necessarily have a desperate need for this functionality in MW-1.45-release.

I'm not really fussed either way we do this, but definitely want to do something in the release before it's final.

It's not documented on https://www.mediawiki.org/wiki/Extension:CheckUser, but it probably should be if it comes out in a release.

I don't think it'll be much work to effectively just revert that commit in master and cherrypick/similar, so I don't have massively strong feelings either way.

Change #1211675 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/CheckUser@master] Remove CheckUserGroupRequirements

https://gerrit.wikimedia.org/r/1211675

Looks like it was added in rECHU46a3c65e82d5: Enforce requirements for temporary-account-viewer group under T393615: Impose technical restrictions on granting the `temporary-account-viewer` group.

Is it worth preventing it shipping in MW-1.45-release too? Obviously we wouldn't be backporting all the changes to add the "same" functionality to MW core and CentralAuth etc.

But if we never ship it in a release, it's never considered stable sooooo....

Could it be marked as unstable in the MW-1.45-release? It would avoid the need to drop the functionality entirely in a release, but makes it clear that in a future wiki version it will no longer exist. IMO I would expect that WMF wikis will be the only users of this feature as it stands in CheckUser.

I think we should drop CheckUserGroupRequirements, and the SpecialUserRightsChangeableGroups hook if possible. They were only added for our IP viewer use-case, and not easily generalizable. It's difficult to imagine third parties already adopting it.

I think it should be a trivial backport (to REL1_45) from master, so if no one has any good reason to keep it around, let's get rid!

Change #1211786 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/core@master] Remove SpecialUserRightsChangeableGroups hook

https://gerrit.wikimedia.org/r/1211786

Change #1211675 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] Remove CheckUserGroupRequirements

https://gerrit.wikimedia.org/r/1211675

Change #1212079 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/CheckUser@REL1_45] Remove CheckUserGroupRequirements

https://gerrit.wikimedia.org/r/1212079

Change #1212079 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@REL1_45] Remove CheckUserGroupRequirements

https://gerrit.wikimedia.org/r/1212079

Change #1211786 merged by jenkins-bot:

[mediawiki/core@master] Remove SpecialUserRightsChangeableGroups hook

https://gerrit.wikimedia.org/r/1211786

Change #1212105 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/core@REL1_45] Remove SpecialUserRightsChangeableGroups hook

https://gerrit.wikimedia.org/r/1212105

The backport for REL1_45 is a bit annoying...

https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1212105/2 (not PS2, not PS3)

I guess the little bit of divergence from/lag behind master is unhelpful, and chasing a load of backports probably won't be a good idea.

The error messages seem to revolve around the same thing..

PS3 is ontop of a backport of https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1212197/1/includes/user/UserGroupAssignmentService.php which itself is going to need more changes (hence the comment above)...

That commit adds a $groups['restricted'] = []; and there is a change to other setting of restricted...


16:35:29 There were 8 errors:
16:35:29 
16:35:29 1) SpecialUserRightsTest::testShowForm
16:35:29 Undefined array key "restricted"
16:35:29 
16:35:29 /workspace/src/includes/specialpage/UserGroupsSpecialPage.php:88
16:35:29 /workspace/src/includes/specials/SpecialUserRights.php:204
16:35:29 /workspace/src/includes/specials/SpecialUserRights.php:134
16:35:29 /workspace/src/tests/phpunit/includes/specials/SpecialPageExecutor.php:131
16:35:29 /workspace/src/tests/phpunit/includes/specials/SpecialPageExecutor.php:60
16:35:29 /workspace/src/tests/phpunit/includes/specials/SpecialPageTestBase.php:81
16:35:29 /workspace/src/tests/phpunit/includes/specials/SpecialUserRightsTest.php:46
Logs generated by test
16:35:29 
16:35:29 2) SpecialUserRightsTest::testShowFormViewMode
16:35:29 Undefined array key "restricted"
16:35:29 
16:35:29 /workspace/src/includes/specialpage/UserGroupsSpecialPage.php:88
16:35:29 /workspace/src/includes/specials/SpecialUserRights.php:204
16:35:29 /workspace/src/includes/specials/SpecialUserRights.php:134
16:35:29 /workspace/src/tests/phpunit/includes/specials/SpecialPageExecutor.php:131
16:35:29 /workspace/src/tests/phpunit/includes/specials/SpecialPageExecutor.php:60
16:35:29 /workspace/src/tests/phpunit/includes/specials/SpecialPageTestBase.php:81
16:35:29 /workspace/src/tests/phpunit/includes/specials/SpecialUserRightsTest.php:59
Logs generated by test
16:35:29 
16:35:29 3) SpecialUserRightsTest::testSaveUserGroups
16:35:29 Undefined array key "restricted"
16:35:29 
16:35:29 /workspace/src/includes/specialpage/UserGroupsSpecialPage.php:88
16:35:29 /workspace/src/includes/specials/SpecialUserRights.php:204
16:35:29 /workspace/src/includes/specials/SpecialUserRights.php:134
16:35:29 /workspace/src/tests/phpunit/includes/specials/SpecialPageExecutor.php:131
16:35:29 /workspace/src/tests/phpunit/includes/specials/SpecialPageExecutor.php:60
16:35:29 /workspace/src/tests/phpunit/includes/specials/SpecialPageTestBase.php:81
16:35:29 /workspace/src/tests/phpunit/includes/specials/SpecialUserRightsTest.php:91
Logs generated by test
16:35:29 
16:35:29 4) SpecialUserRightsTest::testSaveUserGroups_change
16:35:29 Undefined array key "restricted"
16:35:29 
16:35:29 /workspace/src/includes/specialpage/UserGroupsSpecialPage.php:88
16:35:29 /workspace/src/includes/specials/SpecialUserRights.php:204
16:35:29 /workspace/src/includes/specials/SpecialUserRights.php:134
16:35:29 /workspace/src/tests/phpunit/includes/specials/SpecialPageExecutor.php:131
16:35:29 /workspace/src/tests/phpunit/includes/specials/SpecialPageExecutor.php:60
16:35:29 /workspace/src/tests/phpunit/includes/specials/SpecialPageTestBase.php:81
16:35:29 /workspace/src/tests/phpunit/includes/specials/SpecialUserRightsTest.php:142
Logs generated by test
16:35:29 
16:35:29 5) SpecialUserRightsTest::testSaveUserGroups_change_expiry
16:35:29 Undefined array key "restricted"
16:35:29 
16:35:29 /workspace/src/includes/specialpage/UserGroupsSpecialPage.php:88
16:35:29 /workspace/src/includes/specials/SpecialUserRights.php:204
16:35:29 /workspace/src/includes/specials/SpecialUserRights.php:134
16:35:29 /workspace/src/tests/phpunit/includes/specials/SpecialPageExecutor.php:131
16:35:29 /workspace/src/tests/phpunit/includes/specials/SpecialPageExecutor.php:60
16:35:29 /workspace/src/tests/phpunit/includes/specials/SpecialPageTestBase.php:81
16:35:29 /workspace/src/tests/phpunit/includes/specials/SpecialUserRightsTest.php:173
Logs generated by test
16:35:29 
16:35:29 6) SpecialUserRightsTest::testDisplayCurrentGroups
16:35:29 Undefined array key "restricted"
16:35:29 
16:35:29 /workspace/src/includes/specialpage/UserGroupsSpecialPage.php:88
16:35:29 /workspace/src/includes/specials/SpecialUserRights.php:204
16:35:29 /workspace/src/vendor/wikimedia/testing-access-wrapper/src/TestingAccessWrapper.php:114
16:35:29 /workspace/src/tests/phpunit/includes/specials/SpecialUserRightsTest.php:278
Logs generated by test
16:35:29 
16:35:29 7) SpecialUserRightsTest::testSystemUserNotice
16:35:29 Undefined array key "restricted"
16:35:29 
16:35:29 /workspace/src/includes/specialpage/UserGroupsSpecialPage.php:88
16:35:29 /workspace/src/includes/specials/SpecialUserRights.php:204
16:35:29 /workspace/src/includes/specials/SpecialUserRights.php:134
16:35:29 /workspace/src/tests/phpunit/includes/specials/SpecialPageExecutor.php:131
16:35:29 /workspace/src/tests/phpunit/includes/specials/SpecialPageExecutor.php:60
16:35:29 /workspace/src/tests/phpunit/includes/specials/SpecialPageTestBase.php:81
16:35:29 /workspace/src/tests/phpunit/includes/specials/SpecialUserRightsTest.php:311
Logs generated by test
16:35:29 
16:35:29 8) SpecialUserRightsTest::testSupportsWatchUser with data set "User on local wiki" (Closure Object (...), true)
16:35:29 Undefined array key "restricted"
16:35:29 
16:35:29 /workspace/src/includes/specialpage/UserGroupsSpecialPage.php:88
16:35:29 /workspace/src/includes/specials/SpecialUserRights.php:204
16:35:29 /workspace/src/includes/specials/SpecialUserRights.php:134
16:35:29 /workspace/src/tests/phpunit/includes/specials/SpecialPageExecutor.php:131
16:35:29 /workspace/src/tests/phpunit/includes/specials/SpecialPageExecutor.php:60
16:35:29 /workspace/src/tests/phpunit/includes/specials/SpecialPageTestBase.php:81
16:35:29 /workspace/src/tests/phpunit/includes/specials/SpecialUserRightsTest.php:318
Logs generated by test
16:35:29 
16:35:29 --
16:35:29 
16:35:29 There were 2 failures:
16:35:29 
16:35:29 1) UserGroupAssignmentServiceTest::testGetChangeableGroups with data set "Not self" (false)
16:35:29 Failed asserting that two arrays are identical.
16:35:29 --- Expected
16:35:29 +++ Actual
16:35:29 @@ @@
16:35:29      'remove' => Array &2 (
16:35:29          0 => 'remove-group1'
16:35:29      )
16:35:29 -    'restricted' => Array &3 ()
16:35:29  )
16:35:29 
16:35:29 /workspace/src/tests/phpunit/includes/user/UserGroupAssignmentServiceTest.php:166
Logs generated by test
16:35:29 
16:35:29 2) UserGroupAssignmentServiceTest::testGetChangeableGroups with data set "Self" (true)
16:35:29 Failed asserting that two arrays are identical.
16:35:29 --- Expected
16:35:29 +++ Actual
16:35:29 @@ @@
16:35:29          0 => 'remove-group1'
16:35:29          1 => 'remove-group2'
16:35:29      )
16:35:29 -    'restricted' => Array &3 ()
16:35:29  )
16:35:29 
16:35:29 /workspace/src/tests/phpunit/includes/user/UserGroupAssignmentServiceTest.php:160
Logs generated by test

Ah. If backporting it is more costly than the deprecation, then we can just deprecate...

Lets see if https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1212105/4 passes, because I suspect it's going to be a tweak of something along those lines

Change #1212105 merged by jenkins-bot:

[mediawiki/core@REL1_45] Remove SpecialUserRightsChangeableGroups hook

https://gerrit.wikimedia.org/r/1212105