Page MenuHomePhabricator

SpecialBlock [codex] - Can't add IP block if IP is within an already blocked range
Closed, ResolvedPublicBUG REPORT

Description

When multiblocks is disabled if an admin tries to block an IP that is already blocked by a range block, form is never shown

Steps to reproduce:

  • Create a block on 127.0.0.1/16
  • Try to create a block on 127.0.0.20
  • Form is still hidden

Derived Requirement

Ensure that when MultiBlocks is disabled, admins are able to view and interact with the Special:Block form when attempting to block a single IP address that falls within an already blocked IP range.

Test Steps

Test Case 1: Ensure form is visible when blocking an IP within an existing blocked range with MultiBlocks disabled

  1. Disable MultiBlocks ($wgEnableMultiBlocks = false) on the wiki.
  2. Log in as an admin user with permission to block users.
  3. Navigate to Special:Block.
  4. Block the IP range '127.0.0.1/16'.
  5. After the block is created, attempt to block the individual IP '127.0.0.20'.
  6. ✅❓❌⬜ AC1: Confirm that the Special:Block form displays correctly and allows setting a new block on '127.0.0.20'.

Test Case 2: Verify correct behavior when blocking an IP within an existing blocked range with MultiBlocks enabled

  1. Enable MultiBlocks ($wgEnableMultiBlocks = true) on the wiki.
  2. Log in as an admin user with permission to block users.
  3. Navigate to Special:Block.
  4. Block the IP range '127.0.0.1/16'.
  5. After creating the blo, attempt to block the individual IP '127.0.0.20'.
  6. ✅❓❌⬜ AC2: Confirm that the Special:Block form displays correctly, allowing the admin to create an overlapping block on '127.0.0.20' without errors.

QA Results - Local

ACStatusDetails
1T392049#10777595
2T392049#10777595

Event Timeline

@dmaza This is a good catch. Is this with $wgEnableMultiBlocks = false? When it is true, I find I can still press "Add block" to create a block. I think this is a side-effect of T389987.

Reedy renamed this task from SpecialBLock [codex] - Can't add IP block if IP is within an already blocked range to SpecialBlock [codex] - Can't add IP block if IP is within an already blocked range.Wed, Apr 16, 12:18 PM

@dmaza This is a good catch. Is this with $wgEnableMultiBlocks = false? When it is true, I find I can still press "Add block" to create a block. I think this is a side-effect of T389987.

Yes, this is only with $wgEnableMultiBlocks = false. I think it is related to the IP being considered "blocked" by the range. I don't think T389987 is causing this but I'll investigate

dmaza changed the subtype of this task from "Task" to "Bug Report".EditedWed, Apr 16, 2:34 PM

@dom_walden I checked on a random commit ( df3aae487aa ) before T389987 and it is still happening.

@dom_walden I checked on a random commit ( df3aae487aa ) before T389987 and it is still happening.

My bad, pulled the wrong commit. This is indeed happening after T389987

Change #1137317 had a related patch set uploaded (by Dmaza; author: Dmaza):

[mediawiki/core@master] SpecialBlock [codex]: Fix add ip block when block range present

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

Change #1137317 merged by jenkins-bot:

[mediawiki/core@master] SpecialBlock [codex]: Fix add ip block when block range present

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

@dmaza Confirmed that the Special:Block form displays correctly and allows the form to open even within the IP range that is blocked vs Different IP ranges vs IP ranges block within each other, as seen in the gifs. I will mark this as Resolved. Thanks for all your work!

Test Result - Local

Status: ✅ PASS
Environment: Local- MediaWiki: 1.44.0-alpha (4e09390) 17:02, 23 April 2025
OS: macOS Sequoia 15.3.2
Browser: Chrome 135
Device: MBA
Emulated Device: NA

Test Artifact(s):

Test Steps

Test Case 1: Ensure form is visible when blocking an IP within an existing blocked range with MultiBlocks disabled

  1. Disable MultiBlocks ($wgEnableMultiBlocks = false) on the wiki.
  2. Log in as an admin user with permission to block users.
  3. Navigate to Special:Block.
  4. Block the IP range '127.0.0.1/16'.
  5. After the block is created, attempt to block the individual IP '127.0.0.20'.
  6. AC1: Confirm that the Special:Block form displays correctly and allows setting a new block on '127.0.0.20'.
IP Range Blockw/IP Block within Range- Yes Add BlockDifferent IP range blocks not within same range- Yes Add BlockIP Ranges blocks within each other- No Add Block
2025-04-29_08-42-14.mp4.gif (820×1 px, 3 MB)
2025-04-29_08-54-12.mp4.gif (822×1 px, 1 MB)
2025-04-29_09-59-15.mp4.gif (822×1 px, 1 MB)

Test Case 2: Verify correct behavior when blocking an IP within an existing blocked range with MultiBlocks enabled

  1. Enable MultiBlocks ($wgEnableMultiBlocks = true) on the wiki.
  2. Log in as an admin user with permission to block users.
  3. Navigate to Special:Block.
  4. Block the IP range '127.0.0.1/16'.
  5. After the block is created, attempt to block the individual IP '127.0.0.20'.
  6. AC2: Confirm that the Special:Block form displays correctly, allowing the admin to create an overlapping block on '127.0.0.20' without errors.
MB= True
{F59524271}
GMikesell-WMF updated the task description. (Show Details)
GMikesell-WMF updated Other Assignee, removed: GMikesell-WMF.