Page MenuHomePhabricator

Special:CheckUserLog and checkuserlog API do not handle IP ranges the same way
Open, Needs TriagePublicBUG REPORT


While writing a script that interfaces with the checkuser log API, I discovered that it does not handle IP ranges in the same way as Special:CheckUserLog. Searching for an IP or range in Special:CheckUserLog will return checks overlapping the search target (so if I search for, it will return checks made on and on The API, on the other hand, only returns exact matches to the IP or range that was searched.

List of steps to reproduce (step by step, including full links if applicable):

What happens?:
The two searches should return the same list of checks.

What should have happened instead?:
The two results differ - Special:CheckUser lists both checks I made (as well as a few past checks that were overly-broad), while the API lists only the range check that I made.

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc: I think the API is performing an exact string match rather than handling the IP as an IP - if I search both the Special: page and the API for (, Special:CheckUserLog returns the same results (expected) but the API now returns no results (not expected).

Event Timeline

You are right about the comparison being simply text. Relevant code:

if ( isset( $params['target'] ) ) {
	$this->addWhereFld( 'cul_target_text', $params['target'] );

I'll write a patch for this.

Change 791792 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/CheckUser@master] Allow CheckUserLog API to parse CIDR ranges

I'll claim this as I've written a patch.