Page MenuHomePhabricator

Make rollbacks go through AbuseFilter
Open, Needs TriagePublic

Description

Currently, rollbacks are not going through the AbuseFilter. There've been some discussions about this in the past, e.g. T24713 and T25087. Someone said rollbacks are meant to bypass the AbuseFilter. I do not agree, instead, I agree with what @werdna said on T25087: it makes sense to be able to filter all types of actions. Flexibility on the user side is a feature in AbuseFilter. If you want to exclude rollbacks, you do so explicitly in the filter rules. If you want to filter rollbacks for sick purposes, that's a problem of yours, not a reason for us not to implement this feature.

I think the fix here is to add a hook in core before the rollback is committed (currently, we only have a 'RollbackComplete' hook), and add a handler for that in AbuseFilter. I think it should be possible to reuse the AF code for filtering edits.

This is somewhat related to T159725. We'd be able to tell whether an edit is a rollback, but not a (manual) revert though.

Event Timeline

I would say the "action" (as understood by AbuseFilter) should not be "edit" though. Otherwise, as soon as we enable this feature, tons of filters will start to be triggered where they originally were not specifically meant to. The possible collateral is too high.

In other words, I think after this feature is enabled, filters that currently trigger on edits (not uploads or logs, but edits) should still continue to only be triggered for non-rollback edits. If you want them to also be triggered by rollbacks, you should somehow work action = 'rollback' into the rules.

I would say the "action" (as understood by AbuseFilter) should not be "edit" though. Otherwise, as soon as we enable this feature, tons of filters will start to be triggered where they originally were not specifically meant to. The possible collateral is too high.

I don't think it would have much collateral damage: many, if not all, filters already check permissions, and in order to use rollbacks a user must be privileged (e.g. rollbacker, sysop). However, I do think that it's a good idea to make it a different action, also given that we're going to use a different hook etc.

If you want them to also be triggered by rollbacks, you should somehow work action = 'rollback' into the rules.

+1

Daimona moved this task from Backlog to Ideas for overhaul on the User-Daimona board.

Considering for investigation, unsure if it's also suitable for implementation as part of the project.

Not sure if making this feature into a separate action is a good idea. There are three types of reverts out there (undo, rollback, manual) and this would just support one of these, which is rather incomplete. I'd rather propose for AbuseFilter to somehow receive the EditResult object related to the edit, so that all kinds of reverts are treated properly. Then the revert type could be made into an AbuseFilter variable, along with other information about the revert. This would require some kind of overhaul on the core side of things, though, see T159725.

Not sure if making this feature into a separate action is a good idea. There are three types of reverts out there (undo, rollback, manual) and this would just support one of these, which is rather incomplete.

That makes sense. The problem here is that rollbacks are not treated like edits by the core code. The lack of a dedicated hook makes rollback effectively go through any AbuseFilter-like tool, e.g. the spamblacklist (and anything else expecting to catch edits via the EditFilterMergedContent hook).

I'd rather propose for AbuseFilter to somehow receive the EditResult object related to the edit, so that all kinds of reverts are treated properly. Then the revert type could be made into an AbuseFilter variable, along with other information about the revert. This would require some kind of overhaul on the core side of things, though, see T159725.

Another important point: whatever we decide to do, we should stick to that. We cannot introduce a separate action for rollbacks and then, in a few months, decide that rollbacks should be edits instead. That would be hard to do without breaking BC.

Another example: In Chinese Wikipedia there are AbuseFilter to prevent page creators from removing deletion templates and rollbacks also bypass the restriction.