Page MenuHomePhabricator

Throttle groups may be empty or include unknown stuff
Closed, ResolvedPublic

Description

Before switching to OOUI, the throttle groups were specified in a raw textarea with no validation on it (sigh!) and this led to many curious situations. Some of them are already being handled in related tasks, but three aren't:

  1. Groups may be empty. This causes the filter not to throttle at all (groups are required), and is also responsible of T203535 and of PHP warning and notices shown (amongst the others) in AbuseFilter history.
  2. There may be extraneous stuff in there: for instance, misspelled groups ("suer" instead of "user"), non-working stuff ("*" to mean "use all criteria") or even pieces of filter syntax, erroneously pasted there.

The empty case must be handled separately, and I'd like to hear some thoughts about how. We could write a maintenance script to convert it to "user" (should be the default), but this could break filter history. An alternative would to emit some kind of warning (wfWarn?) for some time, then throw an exception in a future MW release. Handled in T203336.
As for the unknown stuff, this is not a real problem: we can intersect the array with the one of known value and get either a valid array, or one with an already mentioned problem. Again, I'm adding this to the script for T203336.

Event Timeline

Change 457086 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] Fix throttle validation to avoid DB query error

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

Another idea is to disable throttle for such filter (in a script like T203336, where the edit should be performed by a system user), or to throw a fatal error if empty groups are found. I'm leaning towards the former, and if we agree for it we should decide whether to create a new maintenance script (but we already have two), or just add this task to an existing one (I'd say the one mentioned above, since the other is for a refactor, instead of unbreaking stuff).

Daimona renamed this task from Throttle groups may be empty, or have duplicates to Throttle groups may be empty, have duplicates or include unknown stuff.Sep 7 2018, 6:26 PM
Daimona updated the task description. (Show Details)
Daimona renamed this task from Throttle groups may be empty, have duplicates or include unknown stuff to Throttle groups may be empty or include unknown stuff.Sep 9 2018, 11:55 AM
Daimona updated the task description. (Show Details)

Change 457086 abandoned by Daimona Eaytoy:
Fix throttle validation to avoid DB query error

Reason:
Superseded by I7831dbb0bab55807392ac1f7915d6cb0cb713593. The few things of the maintenance script that we still need will be included inside the one in Iee56f4726337a42a04e7912e1ee67738fac0b488

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

Change 459368 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] Change throttle selector to restore old functionality, overall improvement

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

Change 468007 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@REL1_32] Change throttle selector to restore old functionality, overall improvement

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

Change 459368 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] Change throttle selector to restore old functionality, overall improvement

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

Change 459245 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] Add normalizeThrottleParameters script to update.php

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

Change 468007 merged by Daimona Eaytoy:
[mediawiki/extensions/AbuseFilter@REL1_32] Change throttle selector to restore old functionality, overall improvement

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

@matmarex This one is waiting for the script to be executed. I think we can consider this as resolved once https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/AbuseFilter/+/459245/ will be merged (and the script executed on WMF wikis).

Change 459245 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] Add normalizeThrottleParameters script to update.php

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

Change 459245 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] Add normalizeThrottleParameters script to update.php

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