Page MenuHomePhabricator

[oauthclient] Undefined offset when decoding JWT
Closed, ResolvedPublic

Description

I'm not quite sure what's going wrong here, but we should probably not assume that a given string has three parts:

list( $headb64, $bodyb64, $sigb64 ) = explode( '.', $JWT );

[2019-01-30 16:01:47] php.WARNING: Notice: Undefined offset: 1 {"exception":"[object] (ErrorException(code: 0): Notice: Undefined offset: 1 at /data/project/svgtranslate/app/vendor/mediawiki/oauthclient/src/Client.php:325)"} []
[2019-01-30 16:01:47] php.WARNING: Notice: Undefined offset: 2 {"exception":"[object] (ErrorException(code: 0): Notice: Undefined offset: 2 at /data/project/svgtranslate/app/vendor/mediawiki/oauthclient/src/Client.php:325)"} []
[2019-01-30 16:01:47] request.CRITICAL: Uncaught PHP Exception MediaWiki\OAuthClient\Exception: "Decoding server response failed: Syntax error (Raw response: z���l(j�a�)�jX�������ͫb�������g���N���h�,ڶ*'���z�"�*.�����-j����ږ'_�����"�)" at /data/project/svgtranslate/app/vendor/mediawiki/oauthclient/src/Client.php line 435 []

This is with the latest code of oauthclient (i.e. includes the recent error reporting improvements).

Event Timeline

Change 487363 had a related patch set uploaded (by Samwilson; owner: Samwilson):
[mediawiki/oauthclient-php@master] Add error checking for JWT format

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

Change 487363 merged by jenkins-bot:
[mediawiki/oauthclient-php@master] Add error checking for JWT and base64 formats

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