Page MenuHomePhabricator

Allow multiple arguments in AbuseFilter's ip_in_range()
Closed, ResolvedPublicFeature

Description

Feature summary (what you would like to be able to do and where):
Have ip_in_range() in the AbuseFilter extension allow multiple arguments.

Use case(s) (list the steps that you performed to discover that problem, and describe the actual underlying problem which you want to solve. Do not describe only a solution):
An example use case is if a filter needs to check multiple IPs, like https://en.wikipedia.org/wiki/Special:AbuseFilter/958

Benefits (why should this be implemented?):
This would allow for more efficient conditions in AbuseFilter conditions; instead of having to have each check burn through one of the 1000 precious conditions, allowing multiple arguments would have it take only one.

Event Timeline

This makes sense to me, just like contains_any vs multiple in statements. And we can create a new function ip_in_ranges and implement it with IPUtils::isInRanges.

Change 789971 had a related patch set uploaded (by WhitePhosphorus; author: WhitePhosphorus):

[mediawiki/extensions/AbuseFilter@master] Add ip_in_ranges function

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

Change 789971 merged by jenkins-bot:

[mediawiki/extensions/AbuseFilter@master] Add ip_in_ranges function

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

Tech news says You can use the search function on Special:AbuseFilter to locate its usage. but Special:AbuseFilter does not seem to have a search function. What am I missing?

Tech news says You can use the search function on Special:AbuseFilter to locate its usage. but Special:AbuseFilter does not seem to have a search function. What am I missing?

Special:AbuseFilter does have a search function in the collapsed form at the top of the page. I think what that sentence means is that you can search for usages of ip_in_range in existing filters with that search form, so you can replace them with the new ip_in_ranges.

Apparently the text field of the search form is limited to certain user groups.

Apparently the text field of the search form is limited to certain user groups.

Good point. I've created T309665 to follow up on that.