Page MenuHomePhabricator

ProtectSite may grant rights to users they do not otherwise have
Closed, ResolvedPublic

Description

In the ProtectSite extension, if rights are left unchanged they may be granted by ProtectSite while the effects of other "protection" are implemented.

https://github.com/wikimedia/mediawiki-extensions-ProtectSite/blob/master/includes/ProtectSite.php#L106

For example, if you have edit restricted to anonymous users (hardcoded in LocalSettings.php or elsewhere) and then try to protect the site against page moves, well anonymous users were just granted the right to edit articles.

ProtectSite should only *restrict* actions, never grant. Ideally through the use of a hook rather than trying to override $wgGroupPermissions.

Event Timeline

Change 834659 had a related patch set uploaded (by Seb35; author: Seb35):

[mediawiki/extensions/ProtectSite@master] Never grant rights when protecting the site

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

I propose the linked patch, adding on each right a preliminary condition ( $wgGroupPermissions[$group][$right] ?? false ) && … to be sure no right can be added but only removed.

Another possible solution would be to use $wgRevokePermissions (doc), but it would remove rights to sysops also.

Also, another solution could be to use PermissionManager::addTemporaryUserRights() (code) to remove rights for this request, but it would be a more risky change since the function is not advertised to remove rights -- I didn’t test it.

The patch currently fails on Jenkins, but it is due to T317499.

Change 834659 merged by jenkins-bot:

[mediawiki/extensions/ProtectSite@master] Never grant rights when protecting the site

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

Seb35 claimed this task.

This is now fixed in branch master, so it will in branches REL1_40 and further, and in versions 0.5.4+.