Page MenuHomePhabricator

Block log does not fully reflect block parameters when block is issued by AbuseFilter
Closed, ResolvedPublic

Description

With T170014 AbuseFilter can issue blocks in which the user is also blocked from editing their own talk page. I was testing this again right now; it works perfectly, but somehow when the block is issued, the block log doesn't list "cannot edit own talk page" in the parameters. In the examples below, the top block is issued by hand, and the second one by AbuseFilter. I verified by checking ipblocks table that they are identically restricting the user from editing their talk page (ipb_allow_usertalk was 0) and also verified on wiki that the user cannot edit their talk page, but as you see the bottom doesn't have the parameter shown in the block log.

* 22:05, 5 March 2018 Admin (talk | contribs | block) blocked BlockMe (talk | contribs) with an expiration time of 2 hours (account creation disabled, cannot edit own talk page) (with blocktalk) (unblock | change block)

* 22:03, 5 March 2018 Abuse filter (talk | contribs | block) blocked BlockMe (talk | contribs) with an expiration time of indefinite (account creation disabled) (Automatically blocked by abuse filter. Description of matched rule: Blocker) (unblock | change block)

Very perplexing; you would think the block log would be independent of where the block was issued.

Event Timeline

Huji created this task.Mar 6 2018, 3:16 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 6 2018, 3:16 AM
Anomie added a subscriber: Anomie.

The Block class doesn't actually create the log entry for the block. The patch that implemented T170014 apparently forgot to add the 'nousertalk' flag into the '6::flags' parameter in log_params. That would be the simple fix for the AbuseFilter bug.

OTOH, the real Technical-Debt fix would be to refactor code in core so there's one "block and log" function to both create a block and log it that can be called from AbuseFilter, Special:Block, and ApiBlock. Currently AbuseFilter::doAbuseFilterBlock() imperfectly duplicates code from SpecialBlock::processForm(), possibly because the latter is far too closely tied to the details of SpecialBlock's web UI.

Daimona claimed this task.Mar 6 2018, 4:00 PM
Daimona added a subscriber: Daimona.

The fix should be easy, working right now.

Change 416709 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] Add logging for preventEditOwnTalk blocks

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

Huji closed this task as Resolved.Mar 7 2018, 2:32 AM
Huji removed a project: Patch-For-Review.

@Anomie, you are correct in your assessment. I will create a separate task for it.

Change 416709 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] Add logging for preventEditOwnTalk blocks

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