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#10952077
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.Apr 16 2025, 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".EditedApr 16 2025, 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 You can still keep on adding IP range blocks even when $wgEnableMultiBlocks = false as seen in gif.

Test Result - Local

Status: ❌ AC1- You can still keep on adding ip range blocks
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 Block❌ Different IP range blocks not within same range- Yes Add Block✅ IP 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.
GMikesell-WMF updated the task description. (Show Details)
GMikesell-WMF updated Other Assignee, added: GMikesell-WMF.
GMikesell-WMF moved this task from QA to In Development on the Community-Tech (Sea Lion Squad) board.

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

[mediawiki/core@master] Fix incorrect form display when multiblocks disabled for IP/IP Ranges

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

Change #1140554 merged by jenkins-bot:

[mediawiki/core@master] Fix incorrect form display when multiblocks disabled for IP/IP Ranges

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

@dmaza You can still keep on adding IP range blocks even when $wgEnableMultiBlocks = false as seen in gif.

Everything looks good as far as I can tell. Feel free to resolve and close this task

GMikesell-WMF updated the task description. (Show Details)
GMikesell-WMF updated Other Assignee, removed: GMikesell-WMF.