10% wp-fail2ban

Code Review | WP fail2ban - Advanced Security Plugin

WordPress plugin WP fail2ban - Advanced Security Plugin scored10%from 54 tests.

About plugin

  • Plugin page: wp-fail2ban
  • Plugin version: 5.2.1
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.2-6.3
  • WordPress version: 6.3.1
  • First release: Oct 19, 2012
  • Latest release: Sep 21, 2023
  • Number of updates: 159
  • Update frequency: every 25.1 days
  • Top authors: invisnet (100%)

Code review

54 tests

User reviews

66 reviews

Install metrics

70,000+ active /1,463,538 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
These installer errors require your attention
  • The plugin did not install without errors
    • > Warning in wp-content/plugins/wp-fail2ban/lib/activation.php+102
    include_once(wp-content/plugins/wp-fail2ban/premium/activation.php): failed to open stream: No such file or directory

Server metrics [RAM: ▲5.22MB] [CPU: ▲5.41ms] 75% from 4 tests

An overview of server-side resources used by WP fail2ban - Advanced Security Plugin
The following require your attention
  • Extra RAM: The extra memory usage should kept under 5MB (currently 5.22MB on /wp-admin/admin.php?page=freemius)
PageMemory (MB)CPU Time (ms)
Home /9.21 ▲5.7576.32 ▲34.38
Dashboard /wp-admin9.23 ▲5.9366.84 ▲16.89
Posts /wp-admin/edit.php9.23 ▲5.8759.57 ▲7.16
Add New Post /wp-admin/post-new.php9.23 ▲3.3461.91 ▼31.87
Media Library /wp-admin/upload.php9.23 ▲6.0060.96 ▲29.44
Freemius Debug [v.2.5.12] /wp-admin/admin.php?page=freemius9.2356.35

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 247 new files
Database: no new tables, 9 new options
New WordPress options
db_upgraded
fs_debug_mode
fs_accounts
theysaidso_admin_options
widget_recent-posts
fs_active_plugins
widget_recent-comments
can_compress_scripts
widget_theysaidso_widget

Browser metrics Passed 4 tests

An overview of browser requirements for WP fail2ban - Advanced Security Plugin
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,966 ▲20513.24 ▼1.065.18 ▲3.1831.79 ▼11.38
Dashboard /wp-admin2,357 ▲1515.15 ▼0.70114.55 ▲11.8998.65 ▲55.61
Posts /wp-admin/edit.php2,143 ▲432.02 ▼0.0235.94 ▼3.3440.23 ▲4.15
Add New Post /wp-admin/post-new.php1,561 ▲1618.06 ▼5.28664.83 ▲49.4161.08 ▲13.31
Media Library /wp-admin/upload.php1,439 ▲364.23 ▲0.01100.04 ▼2.5985.17 ▲37.51
Freemius Debug [v.2.5.12] /wp-admin/admin.php?page=freemius1,1101.7323.7428.75

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • The plugin did not uninstall gracefully
    • > Notice in wp-content/plugins/wp-fail2ban/admin/admin.php+304
    Undefined offset: 0
  • Zombie WordPress options were found after uninstall: 9 options
    • fs_debug_mode
    • widget_recent-comments
    • widget_recent-posts
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • can_compress_scripts
    • fs_active_plugins
    • db_upgraded
    • fs_accounts

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
These server-side errors were triggered
    • > GET request to /wp-admin/admin.php?page=freemius
    • > Notice in wp-content/plugins/wp-fail2ban/admin/admin.php+304
    Undefined offset: 0
    • > GET request to /wp-admin/admin.php?page=freemius
    • > Notice in wp-content/plugins/wp-fail2ban/admin/admin.php+304
    Trying to access array offset on value of type null

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please fix the following
  • 2× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Warning
      include(wp-content/plugins/wp-fail2ban/conf.d/plugins/wp-fail2ban/lib/constants.php): failed to open stream: No such file or directory in wp-content/plugins/wp-fail2ban/conf.d/default-all.php on line 33
    • > PHP Warning
      include(): Failed opening 'wp-content/plugins/wp-fail2ban/conf.d/plugins/wp-fail2ban/lib/constants.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/wp-fail2ban/conf.d/default-all.php on line 33

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser errors were detected

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
7 plugin tags: classicpress, syslog, brute force, login, protection...

wp-fail2ban/wp-fail2ban.php Passed 13 tests

This is the main PHP file of "WP fail2ban - Advanced Security Plugin" version 5.2.1, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
75 characters long description:
Write a myriad of WordPress events to syslog for integration with fail2ban.

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
There were no executable files found in this plugin37,974 lines of code in 178 files:
LanguageFilesBlank linesComment linesLines of code
PHP1558,72720,55537,641
JavaScript43659222
XML2275067
Markdown112028
CSS150015
SVG1001

PHP code 50% from 2 tests

This is a very shot review of cyclomatic complexity and code structure
The following items need your attention
  • Class cyclomatic complexity should be reduced to less than 1000 (currently 3,088)
Cyclomatic complexity
Average complexity per logical line of code0.61
Average class complexity75.87
▷ Minimum class complexity1.00
▷ Maximum class complexity3,088.00
Average method complexity4.35
▷ Minimum method complexity1.00
▷ Maximum method complexity94.00
Code structure
Namespaces4
Interfaces0
Traits0
Classes62
▷ Abstract classes69.68%
▷ Concrete classes5690.32%
▷ Final classes00.00%
Methods1,412
▷ Static methods23116.36%
▷ Public methods98769.90%
▷ Protected methods523.68%
▷ Private methods37326.42%
Functions193
▷ Named functions17791.71%
▷ Anonymous functions168.29%
Constants267
▷ Global constants20074.91%
▷ Class constants6725.09%
▷ Public constants67100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
3 PNG files occupy 0.03MB with 0.01MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/icon.png8.90KB7.57KB▼ 14.91%
vendor/freemius/wordpress-sdk/assets/img/plugin-icon.png9.16KB5.26KB▼ 42.58%
vendor/freemius/wordpress-sdk/assets/img/theme-icon.png10.97KB5.78KB▼ 47.37%