The MediaWiki AbuseFilter extension is a powerful tool used on wikis (like Wikipedia) to automatically detect and react to potentially harmful or undesirable user actions, such as edits, page moves, or account creations.
Here's how it generally works:
-
User Initiates an Action:
A user tries to perform an action on the wiki, for example:
- Saving an edit to a page.
- Creating a new page.
- Moving a page.
- Creating a new user account.
- Uploading a file.
-
Action Interception:
Before the action is actually saved or completed, the AbuseFilter extension intercepts it.
-
Rule Evaluation:
The extension then runs the details of this intercepted action against a set of predefined rules (called "filters"). These filters are created and maintained by wiki administrators or users with specific permissions.
-
Filter Structure:
Each filter consists of:
- Conditions: These are the heart of the filter. They are written in a specific, relatively simple expression language. Conditions check various aspects of the action using variables.
-
Matching and Actions:
If the conditions of a filter are met (i.e., evaluate to "true") for the current user action, the filter "triggers" or "hits." When a filter triggers, it can perform one or more predefined actions:
- Log: Simply record that the filter was matched. This is useful for monitoring or gathering data. (
Special:AbuseLog)
- Tag: Add a specific tag to the edit (e.g., "possible vandalism," "spam link added"). These tags appear in recent changes, page histories, etc.
- Warn: Display a warning message to the user explaining why their action might be problematic. The user can usually choose to ignore the warning and save anyway.
- Disallow: Prevent the action from being completed and display an error message. This is the most common "blocking" action.
- BlockAutopromote: Prevent the user from being automatically promoted to 'autoconfirmed' status for a set period.
- Block: Block the user from editing for a specified duration (less common, usually for severe or repeated offenses identified by very specific filters).
- Throttle: Limit the rate at which a user can perform certain actions if they repeatedly trigger a filter.
- RangeBlock: Block the IP range (rarely used directly by filter actions, more of a manual admin tool).
-
Logging:
All filter matches (hits) are recorded in a special log (Special:AbuseLog). This log shows which filter was triggered, by whom, on what page, and what actions were taken. This is crucial for:
- Reviewing the filter's effectiveness.
- Identifying false positives (legitimate actions incorrectly flagged).
- Identifying false negatives (harmful actions missed by filters).
- Debugging and refining filter rules.
-
Testing:
Administrators can test filters against recent changes or specific text inputs without actually enabling them or applying their actions. This (Special:AbuseFilter/test) is essential for developing and debugging filters safely.
In summary:
The AbuseFilter acts like an automated gatekeeper. It examines user actions based on rules written by humans. If an action matches the criteria for "abuse" (as defined by a rule), the filter can warn the user, tag the action, prevent it, or take other measures, all while logging the event for review.
It's a very flexible system that helps wikis combat vandalism, spam, policy violations, and other disruptive behavior at scale, reducing the burden on human patrollers. However, poorly written filters can lead to false positives, frustrating legitimate users.