?
avatar PhilETaylor
PhilETaylor
18 Jun 2020

Steps to reproduce the issue

Paging @nikosdion

When trying to add YubiKey to Joomla 4.0-dev @ fdab2c0

At the moment I press-to-activate my YubiKey

Expected result

It works without Internal Server Errors.

Actual result

Screenshot 2020-06-18 at 20 43 59

Screenshot 2020-06-18 at 20 47 43

System information (as much as possible)

Safari and Google Chrome on Mac

For those wanting to try YOU NEED A SSL ON YOUR SITE for the option to appear.

Skill up and let me introduce Ngrok ;-) You can do this with ngrok to tunnel back to your computer using their SSL certificate. A simple ngrok http 80 on your computer already running Joomla on port 80 will give you a SSL URL provided by ngrok like https://4d5342c09c3ea.ngrok.io, when you go to that url (yours will be different) you will see YOUR Joomla Site on YOUR computer :) - full details https://ngrok.com

Additional comments

avatar PhilETaylor PhilETaylor - open - 18 Jun 2020
avatar joomla-cms-bot joomla-cms-bot - change - 18 Jun 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 18 Jun 2020
avatar PhilETaylor
PhilETaylor - comment - 18 Jun 2020

Looks to be a requirement of gmp being installed as a php module ..

No such requirement is in the Joomla 4 System Requirements and no warning is given elsewhere that its needed

https://docs.joomla.org/Potential_backward_compatibility_issues_in_Joomla_4#Updated_System_Requirements

After installing GMP for php 7.4 I was able to register my Yubikey.

GMP is an optional module for PHP, thus Joomla 4 needs to either warn that GMP is needed for WebAuth, pollyfill it, update the minimum requirements of Joomla, disable the WebAuth features if no GMP found, or hire some fluffy rabbits for developers to play with .

avatar PhilETaylor PhilETaylor - change - 18 Jun 2020
Title
[4.0][WebAuth] 0 Call to undefined function CBOR\gmp_intval()
[4.0][WebAuthn] 0 Call to undefined function CBOR\gmp_intval()
avatar PhilETaylor PhilETaylor - edited - 18 Jun 2020
avatar nikosdion
nikosdion - comment - 19 Jun 2020

Apparently version 2 of the WebAuthn library has a dependency on GMP that is not listed on the library itself but one if its dependencies, namely spomky-labs/cbor-php. I cannot find a polyfill for it.

IMHO, the correct approach to this is list GMP as an optional requirement, if you want to use WebAuthn. It's not a big deal on real world sites; I've yet to come across a server where GMP is not installed by default and I'm dealing with some terrifyingly crappy hosts when doing support for my clients.

As for local server, um, both MAMP Pro and HomeBrew seem to install it by default. I don't have access to XAMPP or WAMPserver but someone could check that. I know that official PHP binaries on Windows do bundle gmp and seem to enable it by default – at least that's what I remember from a few months ago when I did an IIS, MySQL and PPH installation from scratch. On Ubuntu the default package doesn't include much and you do need to install the individual module packages so, yeah, we need to tell people that this is a requirement for WebAuthn, one that they don't even list in their library but, hey, what can you do? Crypto needs big integer math.

avatar brianteeman
brianteeman - comment - 19 Jun 2020

I can confirm that a default install of php on windows has GMP enabled

avatar nikosdion
nikosdion - comment - 19 Jun 2020

Thank you, Brian!

avatar brianteeman
brianteeman - comment - 19 Jun 2020

Actually I might not be 100% correct. It is enabled on mine. The only things I have ever changed were the things mentioned in your blog post and things specifically reported as needed by joomla.

avatar nikosdion
nikosdion - comment - 19 Jun 2020

I never mentioned GMP since I wasn't (aware that I may have been) using it anywhere and Joomla definitely didn't mention it by name. So it must have been enabled by default. That's also what I remembered.

avatar PhilETaylor
PhilETaylor - comment - 19 Jun 2020

GMP is an optional PHP module like XML and mbstring (both of which are listed as system requirements of Joomla).

SOME people/webhosts/maintainers enabled it by default, some are free to not to. PHP will work without GMP and therefore "someone" has to make the conscious decision to enable GMP in an installation - that decision, it seems, is currently being made before the web hosting customers ask for it.

On a cPanel based server, in Easy Apache 4, GMP is not selected by default. Therefore anyone on a cPanel server will need to have this enabled by the server admin when using WHM.

Screenshot 2020-06-19 at 11 27 01

Furthermore the OFFICIAL JOOMLA docker images do not have the GMP module installed or enabled by default.

Screenshot 2020-06-19 at 11 28 15

avatar PhilETaylor
PhilETaylor - comment - 19 Jun 2020

Anyways... Im sure being able to detect is the module is not installed and showing something better than an Internal Server Error is just a few lines of code right? That would fix this reported issue.

Then maybe we can get Joomla to update their system requirements pages, and documentation around this feature too ?

avatar nikosdion
nikosdion - comment - 19 Jun 2020

Feel free to make a PR for disabling the login button and the backend interface when GMP is not enabled and at-mention me so I can test it.

avatar PhilETaylor PhilETaylor - change - 19 Jun 2020
The description was changed
avatar PhilETaylor PhilETaylor - edited - 19 Jun 2020
avatar wilsonge
wilsonge - comment - 20 Jun 2020

Added to the updated system requirements page too

avatar PhilETaylor PhilETaylor - change - 21 Jun 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-06-21 11:37:46
Closed_By PhilETaylor
avatar PhilETaylor
PhilETaylor - comment - 21 Jun 2020

PR #29731

avatar PhilETaylor PhilETaylor - close - 21 Jun 2020
avatar brianteeman
brianteeman - comment - 30 Jun 2020

As I just upgraded php I checked again and by default gmp is not enabled with php 7.4.7

avatar nikosdion
nikosdion - comment - 30 Jun 2020

But it is shipped with the standard PHP for Windows distribution, right?

avatar brianteeman
brianteeman - comment - 30 Jun 2020

Yes it is shipped - you just need to uncomment it in the ini

avatar nikosdion
nikosdion - comment - 30 Jun 2020

Thank you! That makes it fairly feasible. It would be an entirely different ball game if we had to ask the user to go to PECL and figure out how to download and install the module's DLL :)

avatar PhilETaylor
PhilETaylor - comment - 30 Jun 2020

GMP is not installed in any of the official Joomla docker images.. Im working on that.

Add a Comment

Login with GitHub to post a comment