Page MenuHomePhabricator

Replace and split $wgAbuseFilterRestrictions responsibility with more verbose variable names.
Open, Needs TriagePublic

Description

$wgAbuseFilterRestrictions setting is used for multiple things withing AbuseFilter. Here are the known things where this flag is being used:

  1. For actions in $wgAbuseFilterRestrictions you need abusefilter-modify-restricted to edit the filter, abusefilter-modify isn't enough.
  2. Only actions that are listed in $wgAbuseFilterRestrictions are turned off if the filter reaches certain threshold (af_throttled = true).
  3. To block actions from global filters here
  4. To remove disallow if there are more actions and quote from comments in the code, to prevent double warnings here. This is a separate issue that can be evaluated in a different ticket

We need to create new globals to split $wgAbuseFilterRestrictions responsibilities and make all of these new settings easy to modify/configure.

Event Timeline

dmaza created this task.Sep 7 2017, 12:29 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 7 2017, 12:29 AM

@MusikAnimal Do you know why on extension.json AbuseFilterRestrictions has the key flag, but AbuseFilterActions doesn't? Was flag an action and is not anymore?

@MusikAnimal Do you know why on extension.json AbuseFilterRestrictions has the key flag, but AbuseFilterActions doesn't? Was flag an action and is not anymore?

Might be related to T154091. All enabled filters are "flagged" in the AbuseLog. So while you might consider it an action, there's no way to disable it (nor should you be able to).

Agreed, definitely. This variable should only be used for point 1. Using it for point 2 should be fine, but I agree that we should split them. The one in point 3 makes few sense, and really needs to be split. Point 4 instead is completely wrong. Actually, we should completely rework the way AbuseFilter takes actions: instead of doing it on the fly, it should first iterate through all actions to perform, then choose the ones to apply following a given priority, and then actually do them. This was alrady done for blocks in order to choose the longest duration, and would make T24623 a lot easier. It would also make really clear the action priority, and of course it would automatically avoid double warnings.

Daimona moved this task from Backlog to Next on the User-Daimona board.
Daimona added a comment.EditedSep 21 2018, 5:58 PM

I'd make the change this way:

  1. Keep $wgAbuseFilterRestrictions as it is, and use it for point 1
  2. For point 2, add a new variable like $wgAbuseFilterDangerousActions
  3. Add $wgAbuseFilterBlockingActions for point 3 and 4 (they're used for the same reason), and rename $wgAbuseFilterDisallowGlobalLocalBlocks to $wgAbuseFilterLocallyDisableGlobalBlockingActions

Then make the change in WMF config and copy these lines for new variables.

UPDATE: I was thinking that blocking actions are actually a hardcoded list. So I guess for point 3 and 4 we should add a variable named $wgAbuseFilterOtherBlockingActions with a default of [], and retrieve it using a functions which merges the variable with the hardcoded list. Also, for locally blocking global actions, we could add another variable named $wgAbuseFilterLocallyDisableGlobalActions which should then be an array of actions to disable.

Nirmos renamed this task from Replace and split $wgAbuseFilterRestrictions responsability with more verbose variable names. to Replace and split $wgAbuseFilterRestrictions responsibility with more verbose variable names. .Sep 21 2018, 6:42 PM

Change 462123 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] Split $wgAbuseFilterRestrictions in more specific variables

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

Daimona claimed this task.Sep 22 2018, 10:20 AM
Daimona moved this task from Next to Under review on the User-Daimona board.

Change 462123 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] Split $wgAbuseFilterRestrictions in more specific variables

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