Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Page MenuHomePhabricator

Add/Remove mentor bypass restrictions applied by abusefilter
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Imagine there's an abusefilter looks like the following, with action disallow
page_title = ' MediaWiki:GrowthMentors.json'
& user_name = 'FooBar'
  • User FooBar wants to add them as a mentor

What happens?:
User FooBar could do so, which means they successfully edited the config file MediaWiki:GrowthMentors.json

What should have happened instead?:
User FooBar should not be allowed to do so, as they will trap abusefilter

Software version (skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Urbanecm_WMF triaged this task as High priority.

Thanks for reporting! We intentionally bypass a substantial part of the permissions system (to allow non-admins to enroll as a mentor; normally, they wouldn't be allowed to do so, as the list of mentors is in the MediaWiki namespace). That being said, I don't think we should be bypassing the EditFilterMergedContent hook, which enables AbuseFilters to disallow an edit. I'll upload a patch to change that.

@Stang Please note the filter from the task description would not work even if GrowthExperiments invoked the EditFilterMergedContent hook, because page_title is an unprefixed title (for MediaWiki:GrowthMentors.json, its value would be GrowthMentors.json). For the filter to work (once my patch gets deployed), you'd need to either use page_prefixedtitle = 'MediaWiki:GrowthMentors.json' or page_namespace = 8 & page_title = 'GrowthMentors.json' (one can also condition based on page_id). For details, see AbuseFilter's documentation on MediaWiki.org.

I'd also like to note that setting an AbuseFilter to prevent one user from making /any/ edit to GrowthMentors.json is probably not necessary. It should be possible to (partially) block any user from the JSON page, and that should be already fixed (see T322047).

Hope this helps!

Change 958444 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/GrowthExperiments@master] WikiPageConfigWriter: Run EditFilterMergedContentHook

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

Urbanecm_WMF changed the task status from Open to In Progress.Sep 18 2023, 11:15 AM

Change 958444 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] WikiPageConfigWriter: Run EditFilterMergedContentHook

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

Urbanecm_WMF changed the task status from In Progress to Open.Oct 24 2023, 1:59 PM

According to testing, although AbuseFilter was indeed recorded after the patch, edits were not properly blocked. Moreover, the differences left by AbuseFilter are not correct, and a JSON escape sequence appears.
log: https://zh.wikipedia.beta.wmflabs.org/wiki/Special:AbuseLog/1210
diff: https://zh.wikipedia.beta.wmflabs.org/wiki/Special:Diff/23457

Okay...I can reproduce this in beta. The enrollment form shows the error message, but the edit goes through nevertheless:

image.png (748×1 px, 128 KB)

Thanks for testing and reporting! Moving back to Doing for me to investigate why this happens.

Change 968701 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/GrowthExperiments@master] WikiPageConfigWriter: Do not save edit when AbuseFilter disallows it

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

Change 968757 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/GrowthExperiments@master] i18n: Add GENDER support to a message

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

Change 968757 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/GrowthExperiments@master] i18n: Add GENDER support to a message

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

(linked accidentally)

Change 968701 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] WikiPageConfigWriter: Do not save edit when AbuseFilter disallows it

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

Etonkovidova subscribed.

Checked in beta - seems to work as expected; a disallowed user cannot sign up as a mentor - the following message is displayed:

Screen Shot 2023-10-31 at 2.21.34 PM.png (838×1 px, 132 KB)