78% secure-http-headers

Code Review | Secure HTTP Headers

WordPress plugin Secure HTTP Headers scored78%from 54 tests.

About plugin

  • Plugin page: secure-http-headers
  • Plugin version: 1.0
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.3-5.7
  • WordPress version: 6.3.1
  • First release: Apr 13, 2021
  • Latest release: Apr 13, 2021
  • Number of updates: 5
  • Update frequency: every 0.2 days
  • Top authors: shasha310 (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

100+ active /1,490 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
Installer ran successfully

Server metrics [RAM: ▲0.11MB] [CPU: ▼7.07ms] Passed 4 tests

An overview of server-side resources used by Secure HTTP Headers
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.58 ▲0.1243.24 ▼0.70
Dashboard /wp-admin3.43 ▲0.0850.66 ▼18.36
Posts /wp-admin/edit.php3.48 ▲0.1248.99 ▼0.27
Add New Post /wp-admin/post-new.php6.01 ▲0.1294.98 ▼8.96
Media Library /wp-admin/upload.php3.35 ▲0.1239.72 ▲2.38
Secure HTTP Headers Confirm /wp-admin/admin.php?page=magnisec-headers-confirm3.3439.59
Secure HTTP Headers Setting /wp-admin/admin.php?page=magnisec-headers-setting3.3433.64
Secure HTTP Headers /wp-admin/options-general.php?page=magnisec-headers-server3.3230.89

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

Analyzing filesystem and database footprints of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 13 new files
Database: 3 new tables, 6 new options
New tables
magnisec_headers_website_servers
magnisec_headers_security_headers
magnisec_headers_permissions_directives
New WordPress options
widget_recent-posts
can_compress_scripts
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-comments
db_upgraded

Browser metrics Passed 4 tests

Secure HTTP Headers: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲2214.35 ▲0.001.69 ▼0.1244.90 ▲0.94
Dashboard /wp-admin2,199 ▲225.55 ▼0.0583.07 ▼6.2538.14 ▼1.54
Posts /wp-admin/edit.php2,101 ▲41.98 ▼0.0133.56 ▼2.8736.39 ▲3.38
Add New Post /wp-admin/post-new.php1,531 ▲323.02 ▼0.04633.61 ▼55.5658.05 ▼2.61
Media Library /wp-admin/upload.php1,398 ▼24.20 ▼0.0395.60 ▼2.9540.09 ▼6.54
Secure HTTP Headers Confirm /wp-admin/admin.php?page=magnisec-headers-confirm8582.0222.7941.70
Secure HTTP Headers Setting /wp-admin/admin.php?page=magnisec-headers-setting1,1872.0723.3531.54
Secure HTTP Headers /wp-admin/options-general.php?page=magnisec-headers-server8132.0124.3529.22

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-comments
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
These errors were triggered by the plugin
  • 7 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=magnisec-headers-server
    • > User notice in wp-includes/functions.php+5905
    Function wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder. Please see Debugging in WordPress for more information. (This message was added in version 3.9.0.)
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=magnisec-headers-setting
    • > Notice in wp-content/plugins/secure-http-headers/views/magnisec_headers_form.php+33
    Undefined index: header
    • > GET request to /wp-admin/options-general.php?page=magnisec-headers-server
    • > Notice in wp-content/plugins/secure-http-headers/views/magnisec_headers_server.php+9
    Undefined variable: error

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following items
  • 4× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function MagniSecSecureHeaders\\plugin_dir_path() in wp-content/plugins/secure-http-headers/MagniSecSecureHeaders.php:38
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_register_style() in wp-content/plugins/secure-http-headers/views/magnisec_headers_server.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_register_style() in wp-content/plugins/secure-http-headers/views/magnisec_headers_form.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_register_style() in wp-content/plugins/secure-http-headers/views/magnisec_headers_confirm.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
4 plugin tags: security, headers, cookies, hardening

secure-http-headers/MagniSecSecureHeaders.php 92% from 13 tests

Analyzing the main PHP file in "Secure HTTP Headers" version 1.0
It is important to fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("secure-http-headers.php" instead of "MagniSecSecureHeaders.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Everything looks great! No dangerous files found in this plugin1,208 lines of code in 6 files:
LanguageFilesBlank linesComment linesLines of code
PHP48321784
CSS1100283
JavaScript190141

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.45
Average class complexity78.00
▷ Minimum class complexity78.00
▷ Maximum class complexity78.00
Average method complexity6.50
▷ Minimum method complexity1.00
▷ Maximum method complexity40.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods14
▷ Static methods17.14%
▷ Public methods1392.86%
▷ Protected methods00.00%
▷ Private methods17.14%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
2 PNG files occupy 0.03MB with 0.01MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/icon-128x128.png3.04KB2.04KB▼ 32.81%
assets/banner-772x250.png25.51KB10.97KB▼ 57.01%