Page MenuHomePhabricator

Error authenticating user
Closed, InvalidPublic

Description

I am trying to setup MediaWiki with kanidm as identity provider. The setup should be straightforward and the kanidm logs also don't show any error. The user is authenticated fine.

But I receive the above error message and in the logs I can see:

[PluggableAuth] In execute()
[PluggableAuth] Getting PluggableAuth instance
[PluggableAuth] Plugin name: OpenIDConnect
[OpenIDConnect] Redirect URL: https://wiki.REDACTED/index.php/Special:PluggableAuthLogin
[session] SessionBackend "ie68mhpggjqpbbro9b2dda3gun47aqas" data dirty due to dirty(): Jumbojett\OpenIDConnectClient->commitSession/session_write_close/MediaWiki\Session\PHPSessionHandler->write/MediaWiki\Session\Session->set/MediaWiki\Session\SessionBackend->dirty
[session] SessionBackend "ie68mhpggjqpbbro9b2dda3gun47aqas" data dirty due to dirty(): Jumbojett\OpenIDConnectClient->commitSession/session_write_close/MediaWiki\Session\PHPSessionHandler->write/MediaWiki\Session\Session->set/MediaWiki\Session\SessionBackend->dirty
[session] SessionBackend "ie68mhpggjqpbbro9b2dda3gun47aqas" data dirty due to dirty(): Jumbojett\OpenIDConnectClient->commitSession/session_write_close/MediaWiki\Session\PHPSessionHandler->write/MediaWiki\Session\Session->set/MediaWiki\Session\SessionBackend->dirty
[error] [5950f6742a5ab0be51748908] /index.php/Special:PluggableAuthLogin   PHP Deprecated: Use of $_SESSION was deprecated in MediaWiki 1.27. [Called from session_write_close in (internal function)]
#0 [internal function]: MediaWiki\Exception\MWExceptionHandler::handleError()
#1 /var/www/html/mediawiki/includes/debug/MWDebug.php(372): trigger_error()
#2 /var/www/html/mediawiki/includes/debug/MWDebug.php(342): MediaWiki\Debug\MWDebug::sendRawDeprecated()
#3 /var/www/html/mediawiki/includes/debug/MWDebug.php(224): MediaWiki\Debug\MWDebug::deprecatedMsg()
#4 /var/www/html/mediawiki/includes/GlobalFunctions.php(743): MediaWiki\Debug\MWDebug::deprecated()
#5 /var/www/html/mediawiki/includes/session/PHPSessionHandler.php(354): wfDeprecated()
#6 [internal function]: MediaWiki\Session\PHPSessionHandler->write()
#7 /var/www/html/mediawiki/vendor/jumbojett/openid-connect-php/src/OpenIDConnectClient.php(1926): session_write_close()
#8 /var/www/html/mediawiki/vendor/jumbojett/openid-connect-php/src/OpenIDConnectClient.php(794): Jumbojett\OpenIDConnectClient->commitSession()
#9 /var/www/html/mediawiki/vendor/jumbojett/openid-connect-php/src/OpenIDConnectClient.php(419): Jumbojett\OpenIDConnectClient->requestAuthorization()
#10 /var/www/html/mediawiki/extensions/OpenIDConnect/includes/OpenIDConnect.php(277): Jumbojett\OpenIDConnectClient->authenticate()
#11 /var/www/html/mediawiki/extensions/PluggableAuth/includes/PluggableAuthLogin.php(103): MediaWiki\Extension\OpenIDConnect\OpenIDConnect->authenticate()
#12 /var/www/html/mediawiki/includes/specialpage/SpecialPage.php(711): MediaWiki\Extension\PluggableAuth\PluggableAuthLogin->execute()
#13 /var/www/html/mediawiki/includes/specialpage/SpecialPageFactory.php(1729): MediaWiki\SpecialPage\SpecialPage->run()
#14 /var/www/html/mediawiki/includes/actions/ActionEntryPoint.php(500): MediaWiki\SpecialPage\SpecialPageFactory->executePath()
#15 /var/www/html/mediawiki/includes/actions/ActionEntryPoint.php(144): MediaWiki\Actions\ActionEntryPoint->performRequest()
#16 /var/www/html/mediawiki/includes/MediaWikiEntryPoint.php(184): MediaWiki\Actions\ActionEntryPoint->execute()
#17 /var/www/html/mediawiki/index.php(44): MediaWiki\MediaWikiEntryPoint->run()
#18 {main}
[session] Something wrote to $_SESSION['openid_connect_nonce']!
[session] Something wrote to $_SESSION['openid_connect_state']!
[session] Something wrote to $_SESSION['openid_connect_code_verifier']!
[session] SessionBackend "ie68mhpggjqpbbro9b2dda3gun47aqas" save: dataDirty=1 metaDirty=0 forcePersist=0
[session-sampled] Session store: write for other

Event Timeline

Abulling reopened this task as Open.

What version of jumbojett/OpenID-Connect-PHP are you using? And also what version of MW, the extension etc..

https://github.com/jumbojett/OpenID-Connect-PHP/commit/c000f31a3352ad6f7e2fabca5aa30f4f8b9f9579, which is in v0.8.0 onwards looks to fix this...

jumbojett/OpenID-Connect-PHP: dev-master 3067281
MW: 1.45.3
PluggableAuth: 7.5.0

How have you got dev-master?

https://github.com/wikimedia/mediawiki-extensions-OpenIDConnect/blob/REL1_45/composer.json#L13 has "jumbojett/openid-connect-php": "1.0.2"

Not that it should matter... 3067281 is actually HEAD of master, so should have the fixes... - https://github.com/jumbojett/OpenID-Connect-PHP/tree/3067281

This appears to be a result of more rigorous enforcement in MediaWiki 1.45 of prohibiting the use of directly accessing $_SESSION. While the PluggableAuth and OpenIDConnect extensions do not directly access $_SESSION, the jumbojett OpenID-Connect-PHP library used by the OpenIDConnect extension does do so. It looks like a temporary fix would be to set:

$wgPHPSessionHandling = 'enable';

@matmarex @Tgr What is the recommended long term fix for extensions that need to use libraries that access $_SESSION directly?
.

Please note that this is a deprecation warning, not an error.

It looks like a temporary fix would be to set:

$wgPHPSessionHandling = 'enable';

Yes, this will silence the deprecation warning and temporarily restore the previous behavior (we haven't scheduled yet when this temporary option will stop working).

@matmarex @Tgr What is the recommended long term fix for extensions that need to use libraries that access $_SESSION directly?

The long-term solution is using define( 'MW_NO_SESSION_HANDLER', 1 ); to remove the integration between $_SESSION and MediaWiki sessions. You can then use $_SESSION without being tripped by MediaWiki's session handling. This will match MediaWiki's future behavior when the temporary option is removed.

PHP packages that are unaware of MediaWiki will probably just work under that configuration (although you will have two sets of session cookies, for the two different kinds of sessions).

For MediaWiki extensions, the migration guide is here: https://www.mediawiki.org/wiki/Manual:SessionManager_and_AuthManager/Updating_tips#SessionManager (the page is marked as obsolete because using $_SESSION has been soft-deprecated some 10 years ago, but the advice there is still correct).


There is a note about this in 1.45 release notes: https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/refs/heads/REL1_45/RELEASE-NOTES-1.45#253 – suggestions for improvements are welcome.

Per my previous comment, I don't think there is a software bug here. You can disable these deprecation warnings on your wiki as suggested above.

@Abulling @cicalese Feel free to comment or re-open if there's something we can do to help with the migration.

We're currently thinking about removing the integration and the associated deprecation warnings in 1.47, see T431315. Feel free to comment there as well.

Thank you, @matmarex! Agreed it doesn't sound like a bug. The task author says that the user was authenticated successfully, so it sounds like they were just concerned since the stack trace does say "[error]". I'll take a look at the links you provided!