Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Add 2-factor authentication support for phpMyAdmin. #13495
Signed-off-by: Raghuram email@example.com
Before submitting pull request, please check that every commit:
I've quickly gone through your code, some general remarks:
- Please include documentation, having it in the blog is great, but it really should be part of our documentation.
- Any reason for not integrating 2FA into existing Settings tab?
I tried opening my main phpMyAdmin after pulling your branch (without configuring any user for 2FA or setting up config.inc.php) and got a number of errors. We should be more graceful about failing if the user hasn't configured their system for this.
We'll have to deal gracefully with situations where the user either hasn't configured it or the table doesn't exist.
You can also see for instance libraries/classes/Bookmark.php:114 for an example of how we might deal with this. We have to test the array to make sure $cfgRelation['2fa_secret'] (or whatever configuration directive you use) isn't empty first, before trying to use it. We initialize it as part of the default configuration to an empty value, so before using we'll test if the user has configured it.
Also, you should add the new directive to libraries/config.default.php with a blank assignment such as $cfg['Servers'][$i]['2fa_secret'] = '';. You can add it right after the export_template area around line 503.
We should also add this new directive to libraries/relation.lib.php around line 353; this file is used by chk_rel.php which warns the user if their table structure is outdated.
Can you add the structure for the 2fa_secrets table to
Instead of manually running the SQL, it might be more efficient to use PMA_queryAsControlUser such as
@@ Coverage Diff @@ ## master #13495 +/- ## ========================================== - Coverage 53.17% 52.96% -0.21% ========================================== Files 468 470 +2 Lines 81619 81953 +334 ========================================== + Hits 43404 43410 +6 - Misses 38215 38543 +328