74% security-header-generator

Code Review | Security Header Generator

WordPress plugin Security Header Generator scored74%from 54 tests.

About plugin

  • Plugin page: security-header-g...
  • Plugin version: 4.1.23
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.6.10-6.4
  • WordPress version: 6.3.1
  • First release: Feb 16, 2021
  • Latest release: Oct 30, 2023
  • Number of updates: 125
  • Update frequency: every 7.9 days
  • Top authors: kevp75 (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

400+ active /9,843 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
This plugin's installer ran successfully

Server metrics [RAM: ▲1.94MB] [CPU: ▲7.54ms] Passed 4 tests

An overview of server-side resources used by Security Header Generator
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /5.40 ▲1.9350.61 ▲12.24
Dashboard /wp-admin5.25 ▲1.9457.40 ▲3.50
Posts /wp-admin/edit.php5.30 ▲1.9466.67 ▲18.55
Add New Post /wp-admin/post-new.php7.85 ▲1.9694.88 ▲1.80
Media Library /wp-admin/upload.php5.17 ▲1.9450.78 ▲12.61

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

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 236 new files
Database: no new tables, 7 new options
New WordPress options
theysaidso_admin_options
widget_recent-posts
widget_theysaidso_widget
db_upgraded
widget_recent-comments
wpsh_settings
can_compress_scripts

Browser metrics Passed 4 tests

A check of browser resources used by Security Header Generator
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,864 ▲10314.35 ▼0.011.53 ▼0.0436.06 ▼3.78
Dashboard /wp-admin2,262 ▲825.69 ▲0.0290.10 ▼10.6238.62 ▼4.83
Posts /wp-admin/edit.php2,170 ▲702.04 ▲0.0741.54 ▲5.3736.98 ▲2.01
Add New Post /wp-admin/post-new.php1,588 ▲5918.13 ▼4.91604.29 ▼69.1970.33 ▲16.43
Media Library /wp-admin/upload.php1,467 ▲674.27 ▲0.11100.54 ▼7.8743.09 ▼3.84
Content Security Headers /wp-admin/admin.php?page=wpsh_settings#tab=content-security-headers4,3913.9974.4841.85
Documentation /wp-admin/admin.php?page=wpsh_settings#tab=documentation4,5443.4558.0242.43
Permissions Policy Headers /wp-admin/admin.php?page=wpsh_settings#tab=permissions-policy-headers4,4034.0261.2232.60
Export/Import Settings /wp-admin/admin.php?page=wpsh_settings#tab=export-import-settings4,3983.4555.3828.62
Standard Security Headers /wp-admin/admin.php?page=wpsh_settings#tab=standard-security-headers4,4333.8259.5034.51

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • The plugin did not uninstall gracefully
    • > Notice in wp-includes/option.php+2520
    Trying to access array offset on value of type null
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-comments
    • can_compress_scripts
    • wpsh_settings
    • widget_recent-posts
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Almost there! Just fix the following items
  • 69× PHP files perform the action of outputting non-empty strings when accessed directly (only 10 are shown):
    • > /wp-content/plugins/security-header-generator/vendor/custom-fields/fields/code_editor/index.php
    • > /wp-content/plugins/security-header-generator/index.php
    • > /wp-content/plugins/security-header-generator/vendor/custom-fields/fields/hidden/index.php
    • > /wp-content/plugins/security-header-generator/vendor/custom-fields/fields/media/index.php
    • > /wp-content/plugins/security-header-generator/vendor/custom-fields/fields/switcher/index.php
    • > /wp-content/plugins/security-header-generator/vendor/custom-fields/fields/repeater/index.php
    • > /wp-content/plugins/security-header-generator/vendor/custom-fields/fields/number/index.php
    • > /wp-content/plugins/security-header-generator/vendor/custom-fields/fields/radio/index.php
    • > /wp-content/plugins/security-header-generator/vendor/custom-fields/fields/link_color/index.php
    • > /wp-content/plugins/security-header-generator/work/common.php

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

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
5 plugin tags: permissions, security, permissions policy, content security policy, security headers

security-header-generator/security-header-generator.php Passed 13 tests

This is the main PHP file of "Security Header Generator" version 4.1.23, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
73 characters long description:
Generates proper security headers for the front-end & admin of your site.

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 plugin35,147 lines of code in 140 files:
LanguageFilesBlank linesComment linesLines of code
PHP862,9802,0229,173
Sass201,42537,941
JavaScript71,3215136,627
PO File203,1983,5916,500
CSS63765094,901
JSON1005

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.63
Average class complexity25.29
▷ Minimum class complexity1.00
▷ Maximum class complexity151.00
Average method complexity6.67
▷ Minimum method complexity1.00
▷ Maximum method complexity68.00
Code structure
Namespaces2
Interfaces0
Traits0
Classes69
▷ Abstract classes22.90%
▷ Concrete classes6797.10%
▷ Final classes00.00%
Methods301
▷ Static methods6019.93%
▷ Public methods28293.69%
▷ Protected methods10.33%
▷ Private methods185.98%
Functions34
▷ Named functions2264.71%
▷ Anonymous functions1235.29%
Constants3
▷ Global constants3100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
1 compressed PNG file occupies 0.00MB
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
vendor/custom-fields/assets/images/checkerboard.png2.29KB2.54KB0.00%