Fixed ErrorException: Passkey registration failed:

gib

Well-known member
Affected version
2.3 beta 3
XF2.3 b3

Tried adding a passkey on my iPhone (ios 17.4.1), the error listed below appears in the logs after pressing the continue button.
I have tried with and without friendly URL's, but gives same error with both.

ErrorException: Passkey registration failed: Please enter a value using 16 characters or fewer. src/XF/Error.php:77
Stack trace
#0 src/XF.php(224): XF\Error->logError('Passkey registr...', false)
#1 src/XF/Service/Passkey/Manager.php(200): XF::logError('Passkey registr...')
#2 src/XF/Pub/Controller/Account.php(901): XF\Service\Passkey\Manager->create(Object(XF\Http\Request), NULL)
#3 src/XF/Mvc/Dispatcher.php(352): XF\Pub\Controller\Account->actionPasskeyAdd(Object(XF\Mvc\ParameterBag))
#4 src/XF/Mvc/Dispatcher.php(258): XF\Mvc\Dispatcher->dispatchClass('XF:Account', 'PasskeyAdd', Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Account), NULL)
#5 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Account), NULL)
#6 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#7 src/XF/App.php(2590): XF\Mvc\Dispatcher->run()
#8 src/XF.php(532): XF\App->run()
#9 index.php(20): XF::runApp('XF\\Pub\\App')
#10 {main}
Request state
array(4) {
["url"] => string(20) "/account/passkey/add"
["referrer"] => string(50) "https://blah/index.php?account/security"
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}


1712393375833.webp

1712393399475.webp
 
This eror is caused by IPv6 - the code tries to store IP address as a string into a vield that has a max. length of 16 bytes; that simply isn't enough for a IPv6 (it's fine for IPv4 though).

The code should probably be modified to use entity Ip (like all other systems) - if not the field xf_passkey.create_ip_address must be increased to 39 characters (IPv6 = 128 Bit address = 16 bytes. Human readable string: 8 groups of 2 bytes, each byte represented as hex (=2 bytes) + 1 byte per separator : = 8 * 2 * 2 + 7 * 1 = 39).

If you want to test Passkey without waiting for a fix:
Test with IPv4 or increase the field size.
 
This eror is caused by IPv6 - the code tries to store IP address as a string into a vield that has a max. length of 16 bytes; that simply isn't enough for a IPv6 (it's fine for IPv4 though).

The code should probably be modified to use entity Ip (like all other systems) - if not the field xf_passkey.create_ip_address must be increased to 39 characters (IPv6 = 128 Bit address = 16 bytes. Human readable string: 8 groups of 2 bytes, each byte represented as hex (=2 bytes) + 1 byte per separator : = 8 * 2 * 2 + 7 * 1 = 39).

If you want to test Passkey without waiting for a fix:
Test with IPv4 or increase the field size.
Thanks for the info @Kirby , I will wait for a fix in future releases.
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.3.0 Beta 4).

Change log:
When logging IP addresses for passkeys, make sure they're converted to binary form
There may be a delay before changes are rolled out to the XenForo Community.
 
Back
Top Bottom