Page MenuHomePhabricator

Use getAllowedParams to define the types of user allowed in ApiQueryGlobalUserInfo guiuser param
Closed, ResolvedPublic

Description

ApiQueryGlobalUserInfo::execute returns an error if the guiuser param is an IP address or range:

$username = User::getCanonicalName( $params['user'] );
if ( $username === false ) {
	$this->dieWithError( [ 'apierror-invaliduser', wfEscapeWikiText( $params['user'] ) ] );
}

...since User::getCanonicalName called this way returns false if passed an IP address.

This is not enforced via getAllowedParams, meaning that the normal invalid param error is not encountered, and the documentation incorrectly states that and IP address or CIDR is valid.

Event Timeline

Change 651541 had a related patch set uploaded (by Tchanders; owner: Tchanders):
[mediawiki/extensions/CentralAuth@master] ApiQueryGlobalUserInfo: Specify allowed types for the user param

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

Reedy renamed this task from User getAllowedParams to define the types of user allowed in ApiQueryGlobalUserInfo guiuser param to Use getAllowedParams to define the types of user allowed in ApiQueryGlobalUserInfo guiuser param.Dec 22 2020, 3:35 PM

Change 651541 merged by jenkins-bot:
[mediawiki/extensions/CentralAuth@master] ApiQueryGlobalUserInfo: Specify allowed types for the user param

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