Page MenuHomePhabricator

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


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

Anomie subscribed.

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 subscribed.

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

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