Page MenuHomePhabricator

InvalidArgumentException: Client with identifier does not exist!
Open, Needs TriagePublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   InvalidArgumentException: Client with identifier  does not exist!
FrameLocationCall
from/srv/mediawiki/php-1.44.0-wmf.21/extensions/OAuth/src/Repository/ClientRepository.php(57)
#0/srv/mediawiki/php-1.44.0-wmf.21/vendor/league/oauth2-server/src/Grant/AbstractGrant.php(198)MediaWiki\Extension\OAuth\Repository\ClientRepository->validateClient(string, null, string)
#1/srv/mediawiki/php-1.44.0-wmf.21/vendor/league/oauth2-server/src/Grant/RefreshTokenGrant.php(46)League\OAuth2\Server\Grant\AbstractGrant->validateClient(GuzzleHttp\Psr7\ServerRequest)
#2/srv/mediawiki/php-1.44.0-wmf.21/vendor/league/oauth2-server/src/AuthorizationServer.php(208)League\OAuth2\Server\Grant\RefreshTokenGrant->respondToAccessTokenRequest(GuzzleHttp\Psr7\ServerRequest, League\OAuth2\Server\ResponseTypes\BearerTokenResponse, DateInterval)
#3/srv/mediawiki/php-1.44.0-wmf.21/extensions/OAuth/src/AuthorizationProvider/AccessToken.php(22)League\OAuth2\Server\AuthorizationServer->respondToAccessTokenRequest(GuzzleHttp\Psr7\ServerRequest, MediaWiki\Extension\OAuth\Response)
#4/srv/mediawiki/php-1.44.0-wmf.21/extensions/OAuth/src/Rest/Handler/AccessToken.php(50)MediaWiki\Extension\OAuth\AuthorizationProvider\AccessToken->getAccessTokens(GuzzleHttp\Psr7\ServerRequest, MediaWiki\Extension\OAuth\Response)
#5/srv/mediawiki/php-1.44.0-wmf.21/includes/Rest/Module/Module.php(415)MediaWiki\Extension\OAuth\Rest\Handler\AccessToken->execute()
#6/srv/mediawiki/php-1.44.0-wmf.21/includes/Rest/Module/Module.php(298)MediaWiki\Rest\Module\Module->executeHandler(MediaWiki\Extension\OAuth\Rest\Handler\AccessToken)
#7/srv/mediawiki/php-1.44.0-wmf.21/includes/Rest/Router.php(485)MediaWiki\Rest\Module\Module->execute(string, MediaWiki\Rest\RequestFromGlobals)
#8/srv/mediawiki/php-1.44.0-wmf.21/includes/Rest/Router.php(444)MediaWiki\Rest\Router->doExecute(string, MediaWiki\Rest\RequestFromGlobals)
#9/srv/mediawiki/php-1.44.0-wmf.21/includes/Rest/EntryPoint.php(209)MediaWiki\Rest\Router->execute(MediaWiki\Rest\RequestFromGlobals)
#10/srv/mediawiki/php-1.44.0-wmf.21/includes/MediaWikiEntryPoint.php(202)MediaWiki\Rest\EntryPoint->execute()
#11/srv/mediawiki/php-1.44.0-wmf.21/rest.php(39)MediaWiki\MediaWikiEntryPoint->run()
#12/srv/mediawiki/w/rest.php(3)require(string)
#13{main}
Impact
Notes

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change #1129903 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/OAuth@master] ClientRepository: Add single quotes around $clientIdentifier in validateClient

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

^ obviously doesn't fix it, but stops the double space in the error message when the value is seeming ''

Change #1129903 merged by jenkins-bot:

[mediawiki/extensions/OAuth@master] ClientRepository: Add single quotes around $clientIdentifier in validateClient

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

Change #1130108 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/OAuth@master] ClientRepository: Throw NormalizedException rather than InvalidArgumentException

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

Change #1130109 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/OAuth@REL1_43] ClientRepository: Add single quotes around $clientIdentifier in validateClient

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

Change #1130110 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/OAuth@REL1_42] ClientRepository: Add single quotes around $clientIdentifier in validateClient

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

Change #1130111 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/OAuth@REL1_39] ClientRepository: Add single quotes around $clientIdentifier in validateClient

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

Change #1130111 merged by jenkins-bot:

[mediawiki/extensions/OAuth@REL1_39] ClientRepository: Add single quotes around $clientIdentifier in validateClient

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

Change #1130110 merged by jenkins-bot:

[mediawiki/extensions/OAuth@REL1_42] ClientRepository: Add single quotes around $clientIdentifier in validateClient

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

Change #1130109 merged by jenkins-bot:

[mediawiki/extensions/OAuth@REL1_43] ClientRepository: Add single quotes around $clientIdentifier in validateClient

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

Change #1130108 merged by jenkins-bot:

[mediawiki/extensions/OAuth@master] ClientRepository: Throw NormalizedException rather than InvalidArgumentException

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

Is this a logic error where an invalid client was supposed to be handled somehwere earlier and so this piece of code rightfully doesn't want to deal with it, or a case of using an exception where we should be showing a user error? At a glance it seems to be the latter, given that it's happening in validateClient().

(So probably just return false rather than throwing an exception? I don't know the OAuth 2 codebase well though, so take that with a grain of salt.)