Page MenuHomePhabricator

Special:GlobalBlockWhitelist doesn't always work if a whitelist already exists for an expired block
Closed, ResolvedPublic1 Estimated Story Points

Description

Steps to reproduce

  1. Block ::1 via Special:GlobalBlock
    • (optional) Note the block's ID in globalblocks.gb_id
  2. Go to Special:GlobalBlockWhitelist and locally disable the block for ::1
  3. Remove the block for ::1 via Special:GlobalUnblock
    • (optional) Observe that the row is still present in global_block_whitelist (and gbw_id is the removed block's ID)
  4. Go to Special:GlobalBlockWhitelist. Enter ::1 as the IP address and check "disable". Submit.

Expected: The IP is whitelisted
Actual: See the error You made no change to the local status of this block.

Problem

When a global block is removed, the whitelist row is not removed. This means that row can exist in global_block_whitelist that refers to an old block that doesn't exist any more.

SpecialGlobalBlockStatus looks up (1) whether a block exists for this IP and (2) whether a whitelist exists for this block. However, it uses the user input for (1) rather than the sanitized IP, so it doesn't find a block. So it has no block ID for (2), so only looks up whether the IP is whitelisted for any block ID. If an old whitelist row exists, it finds this and errors out.

Solution

We should use the sanitized IP to look up the block.

Note: Visiting Special:GlobalBlockWhitelist/::1 does work, because this prefills the input with the sanitized IP.

Event Timeline

Change 1012746 had a related patch set uploaded (by Tchanders; author: Tchanders):

[mediawiki/extensions/GlobalBlocking@master] SpecialGlobalBlockStatus: Use sanitized IP to look up existing block

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

Change 1012746 merged by jenkins-bot:

[mediawiki/extensions/GlobalBlocking@master] SpecialGlobalBlockStatus: Use sanitized IP to look up existing block

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

dom_walden subscribed.

The reproduction steps didn't work for me as described. After removing the block, you cannot then change its local status. If it was disabled and you try to re-enable it, you see The user (0:0:0:0:0:0:0:1) you entered is not globally blocked and the corresponding row stays in global_block_whitelist (indefinitely?)

However, if the global block has expired but is still in the globalblocks table then you can re-enable the local status and it will be removed from global_block_whitelist.

I tested changing the local status of IP, temp and user blocks for global blocks which were active, expired (but still in the globalblocks table) and removed.

Test environment: https://de.wikipedia.beta.wmflabs.org GlobalBlocking – (5c38b4b) 08:17, 27 March 2024.