47% security-ninja

Code Review | Security Ninja - Secure Firewall & Secure Malware Scanner

WordPress plugin Security Ninja - Secure Firewall & Secure Malware Scanner scored47%from 54 tests.

About plugin

  • Plugin page: security-ninja
  • Plugin version: 5.163
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-6.4
  • WordPress version: 6.3.1
  • First release: Aug 30, 2016
  • Latest release: Nov 3, 2023
  • Number of updates: 163
  • Update frequency: every 16.1 days
  • Top authors: cleverplugins (52.76%)WebFactory (31.9%)lkoudal (16.56%)

Code review

54 tests

User reviews

92 reviews

Install metrics

10,000+ active /471,755 total downloads

Benchmarks

Plugin footprint 47% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Installer ran successfully

Server metrics [RAM: ▲13.71MB] [CPU: ▲100.30ms] 50% from 4 tests

A check of server-side resources used by Security Ninja - Secure Firewall & Secure Malware Scanner
Please have a look at the following items
  • RAM: Try to keep total memory usage under 10MB (currently 19.35MB on /wp-admin/admin.php?page=freemius)
  • Extra RAM: The extra memory usage must be under 5MB (currently 13.71MB on /wp-admin/admin.php?page=freemius)
PageMemory (MB)CPU Time (ms)
Home /9.63 ▲6.1778.92 ▲39.03
Dashboard /wp-admin19.69 ▲16.39262.90 ▲213.86
Posts /wp-admin/edit.php19.69 ▲16.34163.53 ▲117.34
Add New Post /wp-admin/post-new.php21.85 ▲15.97218.95 ▲124.36
Media Library /wp-admin/upload.php19.61 ▲16.38155.01 ▲120.47
Freemius Debug [v.2.6.0] /wp-admin/admin.php?page=freemius19.35104.32

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

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 334 new files
Database: 1 new table, 10 new options
New tables
wp_wf_sn_tests
New WordPress options
widget_theysaidso_widget
fs_active_plugins
fs_debug_mode
wf_sn_vu_outdated
fs_accounts
widget_recent-comments
db_upgraded
widget_recent-posts
theysaidso_admin_options
can_compress_scripts

Browser metrics Passed 4 tests

A check of browser resources used by Security Ninja - Secure Firewall & Secure Malware Scanner
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,018 ▲27113.60 ▼0.754.89 ▲3.1531.57 ▼12.44
Dashboard /wp-admin2,392 ▲2114.87 ▼0.82126.49 ▲13.4757.17 ▲11.17
Posts /wp-admin/edit.php2,213 ▲1102.36 ▲0.4149.33 ▲12.2543.53 ▲10.12
Add New Post /wp-admin/post-new.php1,559 ▲2322.10 ▼1.07677.21 ▼12.0647.05 ▼7.37
Media Library /wp-admin/upload.php1,512 ▲1124.43 ▲0.22106.14 ▲1.8947.04 ▲0.48
Freemius Debug [v.2.6.0] /wp-admin/admin.php?page=freemius1,1862.0045.0234.85

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • Uninstall procedure validation failed for this plugin
    • > Notice in wp-content/plugins/security-ninja/freemius/includes/class-freemius.php+8546
    Undefined property: stdClass::$plugins
  • The plugin did not uninstall successfully, leaving 1 table in the database
    • wp_wf_sn_tests
  • This plugin did not uninstall successfully, leaving 10 options in the database
    • widget_recent-comments
    • widget_recent-posts
    • db_upgraded
    • widget_theysaidso_widget
    • fs_accounts
    • theysaidso_admin_options
    • fs_active_plugins
    • fs_debug_mode
    • can_compress_scripts
    • wf_sn_vu_outdated

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
  • 3× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/security-ninja/modules/vulnerabilities/class-wf-sn-vu.php
    • > /wp-content/plugins/security-ninja/vendor/donatj/phpuseragentparser/bin/benchmark.php
    • > /wp-content/plugins/security-ninja/modules/welcome/class-sec-nin-welcome.php
  • 24× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'TypistTech\\Imposter\\FilesystemInterface' not found in wp-content/plugins/security-ninja/vendor/typisttech/imposter/src/Filesystem.php:12
    • > PHP Fatal error
      Uncaught Error: Interface 'TypistTech\\Imposter\\ImposterInterface' not found in wp-content/plugins/security-ninja/vendor/typisttech/imposter/src/Imposter.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'WPSecurityNinja\\Plugin\\phpseclib\\Crypt\\Base' not found in wp-content/plugins/security-ninja/vendor/phpseclib/phpseclib/phpseclib/Crypt/Blowfish.php:129
    • > PHP Fatal error
      Uncaught Error: Interface 'TypistTech\\Imposter\\ConfigCollectionInterface' not found in wp-content/plugins/security-ninja/vendor/typisttech/imposter/src/ConfigCollection.php:7
    • > PHP Warning
      require(wp-content/plugins/security-ninja/vendor/donatj/phpuseragentparser/bin/../vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/security-ninja/vendor/donatj/phpuseragentparser/bin/init_user_agent.php on line 3
    • > PHP Fatal error
      Uncaught Error: Interface 'TypistTech\\Imposter\\ConfigInterface' not found in wp-content/plugins/security-ninja/vendor/typisttech/imposter/src/Config.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'TypistTech\\Imposter\\Config' not found in wp-content/plugins/security-ninja/vendor/typisttech/imposter/src/ProjectConfig.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'WPSecurityNinja\\Plugin\\phpseclib\\Crypt\\Rijndael' not found in wp-content/plugins/security-ninja/vendor/phpseclib/phpseclib/phpseclib/Crypt/AES.php:59
    • > PHP Warning
      require(wp-content/plugins/security-ninja/vendor/donatj/phpuseragentparser/bin/../vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/security-ninja/vendor/donatj/phpuseragentparser/bin/user_agent_sorter.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'IP2Location\\Database' not found in wp-content/plugins/security-ninja/vendor/ip2location/ip2location-php/example.php:17

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

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
8 plugin tags: malware scanner, block hackers, hack, login security, firewall...

security-ninja/security-ninja.php 92% from 13 tests

"Security Ninja - Secure Firewall & Secure Malware Scanner" version 5.163's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
The following require your attention:
  • Description: Please keep the plugin description shorter than 140 characters (currently 256 characters long)

Code Analysis 0% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
It is important to fix the following items
  • Do not distribute dangerous files with your plugin
    • .bin - Binary Executable in Windows, macOS, Linux
      • wp-content/plugins/security-ninja/vendor/ip2location/ip2location-php/databases/IP2LOCATION-LITE-DB1.BIN
67,936 lines of code in 251 files:
LanguageFilesBlank linesComment linesLines of code
PHP19713,56233,44763,684
JSON9002,020
Sass125801,026
Markdown123130717
JavaScript1079107379
YAML413071
XML272121
CSS140114
make1003
SVG1001

PHP code 0% from 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Please fix the following
  • Class cyclomatic complexity should be reduced to less than 1000 (currently 3,096)
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 109)
Cyclomatic complexity
Average complexity per logical line of code0.51
Average class complexity81.76
▷ Minimum class complexity1.00
▷ Maximum class complexity3,096.00
Average method complexity5.23
▷ Minimum method complexity1.00
▷ Maximum method complexity109.00
Code structure
Namespaces15
Interfaces7
Traits0
Classes108
▷ Abstract classes43.70%
▷ Concrete classes10496.30%
▷ Final classes00.00%
Methods2,249
▷ Static methods42618.94%
▷ Public methods1,78979.55%
▷ Protected methods200.89%
▷ Private methods44019.56%
Functions133
▷ Named functions11485.71%
▷ Anonymous functions1914.29%
Constants406
▷ Global constants14134.73%
▷ Class constants26565.27%
▷ Public constants26499.62%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
5 PNG files occupy 0.04MB with 0.01MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
freemius/assets/img/plugin-icon.png9.16KB5.26KB▼ 42.58%
images/security-ninja-logo.png6.74KB7.44KB0.00%
freemius/assets/img/theme-icon.png10.97KB5.78KB▼ 47.37%
images/helpscout.png4.79KB5.10KB0.00%
images/plugin-icon.png9.41KB4.79KB▼ 49.13%