10% ninjafirewall

Code Review | NinjaFirewall (WP Edition) - Advanced Security Plugin and Firewall

WordPress plugin NinjaFirewall (WP Edition) - Advanced Security Plugin and Firewall scored10%from 54 tests.

About plugin

  • Plugin page: ninjafirewall
  • Plugin version: 4.5.10
  • PHP compatiblity: 7.1+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9-6.4
  • WordPress version: 6.3.1
  • First release: Mar 30, 2013
  • Latest release: Oct 31, 2023
  • Number of updates: 696
  • Update frequency: every 5.6 days
  • Top authors: nintechnet (100%)

Code review

54 tests

User reviews

202 reviews

Install metrics

100,000+ active /1,890,092 total downloads

Benchmarks

Plugin footprint 57% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Please fix the following installer errors
  • Install procedure validation failed for this plugin
    • > Warning in wp-content/plugins/ninjafirewall/lib/install_default.php+187
    file_put_contents(wp-content/nfwlog/dropins.php): failed to open stream: No such file or directory

Server metrics [RAM: ▲1.09MB] [CPU: ▼1.00ms] Passed 4 tests

Server-side resources used by NinjaFirewall (WP Edition) - Advanced Security Plugin and Firewall
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /4.33 ▲0.8651.08 ▲7.45
Dashboard /wp-admin4.61 ▲1.3053.11 ▲4.18
Posts /wp-admin/edit.php4.61 ▲1.2552.11 ▲2.37
Add New Post /wp-admin/post-new.php6.86 ▲0.9785.49 ▼18.01
Media Library /wp-admin/upload.php4.61 ▲1.3844.81 ▲10.05
Logs /wp-admin/admin.php?page=nfsublog4.6141.73
Dashboard /wp-admin/admin.php?page=NinjaFirewall4.6141.59
WP+ Edition /wp-admin/admin.php?page=nfsubwplus4.6139.07
Event Notifications /wp-admin/admin.php?page=nfsubevent4.6137.99
Security Rules /wp-admin/admin.php?page=nfsubupdates4.7237.58
Firewall Options /wp-admin/admin.php?page=nfsubopt4.6137.73
Monitoring /wp-admin/admin.php?page=nfsubfileguard4.6138.01
Login Protection /wp-admin/admin.php?page=nfsubloginprot4.6136.78
Firewall Policies /wp-admin/admin.php?page=nfsubpolicies4.9242.19
Anti-Malware /wp-admin/admin.php?page=nfsubmalwarescan4.6135.39

Server storage [IO: ▲2.62MB] [DB: ▲0.09MB] 67% from 3 tests

Input-output and database impact of this plugin
Please fix the following
  • You have illegally modified 12 files (2.47KB) outside of "wp-content/plugins/ninjafirewall/" and "wp-content/uploads/"
    • (new file) wp-content/nfwlog/cache/livelog.php
    • (new file) wp-content/nfwlog/.htaccess
    • (new file) wp-content/nfwlog/cache/.htaccess
    • (new file) wp-content/nfwlog/cache/db_hash.1.php
    • (new file) wp-content/nfwlog/index.html
    • (new file) wp-content/nfwlog/ninjafirewall.php
    • (new file) wp-content/mu-plugins/0-ninjafirewall.php
    • (new file) wp-content/nfwlog/cache/index.html
    • (new file) wp-content/nfwlog/cache/.pid
    • (new file) wp-content/nfwlog/firewall_2023-10.php
    • ...
Filesystem: 100 new files
Database: no new tables, 8 new options
New WordPress options
nfw_options
widget_theysaidso_widget
widget_recent-posts
theysaidso_admin_options
db_upgraded
can_compress_scripts
nfw_rules
widget_recent-comments

Browser metrics Passed 4 tests

NinjaFirewall (WP Edition) - Advanced Security Plugin and Firewall: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,960 ▲21414.33 ▲0.052.11 ▲0.3747.28 ▲4.65
Dashboard /wp-admin2,366 ▲1865.65 ▼0.0286.32 ▼6.1067.21 ▲28.20
Posts /wp-admin/edit.php2,159 ▲561.98 ▲0.0435.27 ▼5.5235.84 ▼1.49
Add New Post /wp-admin/post-new.php1,588 ▲6221.95 ▼1.08656.46 ▲30.6354.75 ▲1.34
Media Library /wp-admin/upload.php1,459 ▲594.16 ▼0.0697.27 ▼7.1462.73 ▲20.17
Logs /wp-admin/admin.php?page=nfsublog3,2191.9228.4135.94
Dashboard /wp-admin/admin.php?page=NinjaFirewall1,5813.1073.2942.12
WP+ Edition /wp-admin/admin.php?page=nfsubwplus1,2842.0533.0349.30
Event Notifications /wp-admin/admin.php?page=nfsubevent1,2541.8730.3729.94
Security Rules /wp-admin/admin.php?page=nfsubupdates2,2621.7125.0126.59
Firewall Options /wp-admin/admin.php?page=nfsubopt1,2041.7524.9433.10
Monitoring /wp-admin/admin.php?page=nfsubfileguard1,1581.7127.3531.80
Login Protection /wp-admin/admin.php?page=nfsubloginprot1,3371.8725.5326.17
Firewall Policies /wp-admin/admin.php?page=nfsubpolicies3,1971.7629.1539.99
Anti-Malware /wp-admin/admin.php?page=nfsubmalwarescan8941.8325.7626.63

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
You still need to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_recent-comments
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-posts
    • theysaidso_admin_options
    • db_upgraded

Smoke tests 50% 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 0% 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 items
  • 31× PHP files perform the action of outputting non-empty strings when accessed directly (only 10 are shown):
    • > /wp-content/plugins/ninjafirewall/lib/email_sodium.php
    • > /wp-content/plugins/ninjafirewall/lib/dashboard_about.php
    • > /wp-content/plugins/ninjafirewall/lib/monitoring_file_guard.php
    • > /wp-content/plugins/ninjafirewall/lib/monitoring_file_check.php
    • > /wp-content/plugins/ninjafirewall/lib/wpplus.php
    • > /wp-content/plugins/ninjafirewall/lib/security_rules_editor.php
    • > /wp-content/plugins/ninjafirewall/lib/firewall.php
    • > /wp-content/plugins/ninjafirewall/lib/event_notifications.php
    • > /wp-content/plugins/ninjafirewall/lib/custom_plugin.php
    • > /wp-content/plugins/ninjafirewall/lib/monitoring.php
  • 1× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/ninjafirewall/lib/i18n-extra.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser errors were detected

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
Attributes that need to be fixed:
  • Tags: You are using too many tags: 16 tag instead of maximum 10
Please take inspiration from this readme.txt

ninjafirewall/ninjafirewall.php Passed 13 tests

The main file in "NinjaFirewall (WP Edition) - Advanced Security Plugin and Firewall" v. 4.5.10 serves as a complement to information provided in readme.txt and as the entry point to the plugin
64 characters long description:
A true Web Application Firewall to protect and secure WordPress.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
There were no executable files found in this plugin16,649 lines of code in 49 files:
LanguageFilesBlank linesComment linesLines of code
PHP412,2293,51710,200
PO File11,8383,7625,312
JavaScript3107121743
CSS11221391
HTML3003

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.53
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions204
▷ Named functions20299.02%
▷ Anonymous functions20.98%
Constants79
▷ Global constants7594.94%
▷ Class constants45.06%
▷ Public constants4100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
34 PNG files occupy 0.84MB with 0.22MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/ninjafirewall_20.png0.57KB1.01KB0.00%
images/bar-critical.png0.16KB0.16KB▼ 1.82%
images/screenshots/firewall-log.png153.03KB39.35KB▼ 74.29%
images/rate.png0.54KB0.49KB▼ 10.07%
images/ninjafirewall_75.png5.59KB3.11KB▼ 44.49%