joomla / joomla-cms

Home of the Joomla! Content Management System
https://www.joomla.org
GNU General Public License v2.0
4.74k stars 3.64k forks source link

[5.1] Passkey login events missing subjects #44229

Open peter1szalatnay opened 2 days ago

peter1szalatnay commented 2 days ago

Steps to reproduce the issue

Login with passkey and have xdebug enabled.

Plugin events 'onUserAfterLogin' and 'onUserLoginFailure' in plugins/system/webauthn/src/PluginTraits/AjaxHandlerLogin.php are missing the required 'subject' and or 'options' value for the event.

Expected result

Login without an error.

Actual result

Just an example when one of them failing.

Error: Uncaught TypeError: Joomla\CMS\Event\User\AbstractLoginEvent::onSetOptions(): Argument #1 ($value) must be of type array, null given, called in /usr/share/nginx/html/libraries/src/Event/AbstractEvent.php on line 227 and defined in /usr/share/nginx/html/libraries/src/Event/User/AbstractLoginEvent.php:56 Stack trace:

0 /usr/share/nginx/html/libraries/src/Event/AbstractEvent.php(227): Joomla\CMS\Event\User\AbstractLoginEvent->onSetOptions(NULL)

1 /usr/share/nginx/html/libraries/src/Event/AbstractEvent.php(115): Joomla\CMS\Event\AbstractEvent->setArgument('options', NULL)

2 /usr/share/nginx/html/libraries/src/Event/AbstractImmutableEvent.php(51): Joomla\CMS\Event\AbstractEvent->__construct('onUserLoginFail...', Array)

3 /usr/share/nginx/html/libraries/src/Event/User/UserEvent.php(55): Joomla\CMS\Event\AbstractImmutableEvent->__construct('onUserLoginFail...', Array)

4 /usr/share/nginx/html/plugins/system/webauthn/src/PluginTraits/AjaxHandlerLogin.php(268): Joomla\CMS\Event\User\UserEvent->__construct('onUserLoginFail...', Array)

5 /usr/share/nginx/html/plugins/system/webauthn/src/PluginTraits/AjaxHandlerLogin.php(118): Joomla\Plugin\System\Webauthn\Extension\Webauthn->processLoginFailure(Object(Joomla\CMS\Authentication\AuthenticationResponse))

6 /usr/share/nginx/html/libraries/vendor/joomla/event/src/Dispatcher.php(454): Joomla\Plugin\System\Webauthn\Extension\Webauthn->onAjaxWebauthnLogin(Object(Joomla\CMS\Event\Plugin\System\Webauthn\AjaxLogin))

7 /usr/share/nginx/html/plugins/system/webauthn/src/PluginTraits/AjaxHandler.php(125): Joomla\Event\Dispatcher->dispatch('onAjaxWebauthnL...', Object(Joomla\CMS\Event\Plugin\System\Webauthn\AjaxLogin))

8 /usr/share/nginx/html/libraries/vendor/joomla/event/src/Dispatcher.php(454): Joomla\Plugin\System\Webauthn\Extension\Webauthn->onAjaxWebauthn(Object(Joomla\CMS\Event\Plugin\AjaxEvent))

9 /usr/share/nginx/html/components/com_ajax/ajax.php(136): Joomla\Event\Dispatcher->dispatch('onAjaxWebauthn', Object(Joomla\CMS\Event\Plugin\AjaxEvent))

10 /usr/share/nginx/html/libraries/src/Dispatcher/LegacyComponentDispatcher.php(71): require_once('/usr/share/ngin...')

11 /usr/share/nginx/html/libraries/src/Dispatcher/LegacyComponentDispatcher.php(73): Joomla\CMS\Dispatcher\LegacyComponentDispatcher::Joomla\CMS\Dispatcher{closure}('/usr/share/ngin...')

12 /usr/share/nginx/html/libraries/src/Component/ComponentHelper.php(361): Joomla\CMS\Dispatcher\LegacyComponentDispatcher->dispatch()

13 /usr/share/nginx/html/libraries/src/Application/SiteApplication.php(218): Joomla\CMS\Component\ComponentHelper::renderComponent('com_ajax')

14 /usr/share/nginx/html/libraries/src/Application/SiteApplication.php(261): Joomla\CMS\Application\SiteApplication->dispatch()

15 /usr/share/nginx/html/libraries/src/Application/CMSApplication.php(306): Joomla\CMS\Application\SiteApplication->doExecute()

16 /usr/share/nginx/html/includes/app.php(58): Joomla\CMS\Application\CMSApplication->execute()

17 /usr/share/nginx/html/index.php(32): require_once('/usr/share/ngin...')

18 {main}

thrown

System information (as much as possible)

dbserver: mysql dbversion: 8.0.29-21 phpversion: 8.3.12 server: nginx/1.27.1 sapi_name: fpm-fcgi version: Joomla! 5.1.4 Stable [ Kudumisha ] 27-August-2024 16:00 GMT

Additional comments

Fedik commented 1 day ago

In theory it should be fixed with https://github.com/joomla/joomla-cms/pull/43934 in 5.2 Please test