84% duo-wordpress

Code Review | Duo Two-Factor Authentication

WordPress plugin Duo Two-Factor Authentication scored84%from 54 tests.

About plugin

  • Plugin page: duo-wordpress
  • Plugin version: 2.5.7
  • PHP version: 7.4.16
  • WordPress compatibility: 4.1-6.0
  • WordPress version: 6.3.1
  • First release: May 15, 2011
  • Latest release: Jun 1, 2022
  • Number of updates: 143
  • Update frequency: every 28.2 days
  • Top authors: duosecurity (100%)

Code review

54 tests

User reviews

38 reviews

Install metrics

9,000+ active /151,704 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.02MB] [CPU: ▼4.51ms] Passed 4 tests

A check of server-side resources used by Duo Two-Factor Authentication
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0240.34 ▼2.82
Dashboard /wp-admin3.33 ▲0.0253.63 ▼2.03
Posts /wp-admin/edit.php3.38 ▲0.0246.44 ▼2.91
Add New Post /wp-admin/post-new.php5.91 ▲0.0297.12 ▼10.27
Media Library /wp-admin/upload.php3.25 ▲0.0239.79 ▲5.29
Duo Two-Factor /wp-admin/options-general.php?page=duo_wordpress3.2236.04

Server storage [IO: ▲0.08MB] [DB: ▲0.00MB] Passed 3 tests

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 9 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
db_upgraded
widget_recent-comments
widget_theysaidso_widget
widget_recent-posts
can_compress_scripts

Browser metrics Passed 4 tests

Duo Two-Factor Authentication: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲5813.27 ▼1.401.73 ▼0.1543.84 ▼0.77
Dashboard /wp-admin2,210 ▲224.80 ▼1.07102.27 ▼14.5641.12 ▼1.96
Posts /wp-admin/edit.php2,093 ▲42.05 ▲0.0440.17 ▲0.1231.31 ▼2.79
Add New Post /wp-admin/post-new.php1,536 ▲1723.39 ▲0.20676.45 ▲31.9462.82 ▲16.98
Media Library /wp-admin/upload.php1,395 ▲74.18 ▼0.0199.06 ▼12.7741.75 ▼1.18
Duo Two-Factor /wp-admin/options-general.php?page=duo_wordpress8672.0527.0729.52

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 75% from 4 tests

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • can_compress_scripts
    • db_upgraded
    • widget_recent-posts
    • widget_recent-comments

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following
  • 2× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/duo-wordpress/uninstall.php
    • > /wp-content/plugins/duo-wordpress/duo_wordpress.php

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
8 plugin tags: password, two-factor, login, username, authentication...

duo-wordpress/duo_wordpress.php 92% from 13 tests

This is the main PHP file of "Duo Two-Factor Authentication" version 2.5.7, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
You should first fix the following items:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("duo-wordpress.php" instead of "duo_wordpress.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Good job! No executable or dangerous file extensions detected1,028 lines of code in 6 files:
LanguageFilesBlank linesComment linesLines of code
PHP313483765
JavaScript254124253
Markdown18010

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity19.00
▷ Minimum class complexity19.00
▷ Maximum class complexity19.00
Average method complexity5.50
▷ Minimum method complexity2.00
▷ Maximum method complexity10.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods4
▷ Static methods4100.00%
▷ Public methods250.00%
▷ Protected methods00.00%
▷ Private methods250.00%
Functions42
▷ Named functions42100.00%
▷ Anonymous functions00.00%
Constants12
▷ Global constants00.00%
▷ Class constants12100.00%
▷ Public constants12100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
There were not PNG files found in your plugin