68% gd-security-headers

Code Review | GD Security Headers

WordPress plugin GD Security Headers scored68%from 54 tests.

About plugin

  • Plugin page: gd-security-headers
  • Plugin version: 1.7.1
  • PHP compatiblity: 7.3+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.3-6.3
  • WordPress version: 6.3.1
  • First release: Mar 28, 2019
  • Latest release: Oct 29, 2023
  • Number of updates: 29
  • Update frequency: every 57.8 days
  • Top authors: GDragoN (100%)

Code review

54 tests

User reviews

7 reviews

Install metrics

2,000+ active /16,718 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲0.19MB] [CPU: ▼2.80ms] Passed 4 tests

Analyzing server-side resources used by GD Security Headers
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.63 ▲0.1747.89 ▲4.99
Dashboard /wp-admin3.50 ▲0.2049.66 ▼0.53
Posts /wp-admin/edit.php3.55 ▲0.2048.14 ▼3.87
Add New Post /wp-admin/post-new.php6.08 ▲0.2087.00 ▼11.78
Media Library /wp-admin/upload.php3.42 ▲0.2045.18 ▲12.93

Server storage [IO: ▲2.67MB] [DB: ▲0.02MB] Passed 3 tests

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 197 new files
Database: 2 new tables, 6 new options
New tables
wp_gdsec_xxp_reports
wp_gdsec_csp_reports
New WordPress options
widget_recent-comments
db_upgraded
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-posts
can_compress_scripts

Browser metrics Passed 4 tests

GD Security Headers: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,861 ▲10014.36 ▲0.012.16 ▲0.5246.78 ▼1.84
Dashboard /wp-admin2,264 ▲875.68 ▲0.15103.33 ▲12.1749.20 ▲7.68
Posts /wp-admin/edit.php2,175 ▲782.05 ▲0.0345.17 ▲9.2346.05 ▲13.90
Add New Post /wp-admin/post-new.php1,569 ▲3423.13 ▲5.00677.54 ▲52.9463.97 ▼4.29
Media Library /wp-admin/upload.php1,472 ▲724.19 ▼0.08117.36 ▲19.1950.55 ▲5.69

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
It is recommended to fix the following
  • The plugin did not uninstall successfully, leaving 2 tables in the database
    • wp_gdsec_xxp_reports
    • wp_gdsec_csp_reports
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-posts
    • widget_theysaidso_widget
    • widget_recent-comments
    • can_compress_scripts
    • db_upgraded
    • theysaidso_admin_options

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though everything seems fine, this is not an exhaustive test

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 take a closer look at the following
  • 1× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/gd-security-headers/forms/about/whatsnew.php
  • 23× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/gd-security-headers/forms/dashboard/headers.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function do_action() in wp-content/plugins/gd-security-headers/forms/shared/top.php:3
    • > PHP Warning
      include(GDSIH_PATHforms/about/minor.php): failed to open stream: No such file or directory in wp-content/plugins/gd-security-headers/forms/about/whatsnew.php on line 1
    • > PHP Warning
      include(GDSIH_D4PLIBshared/d4p.about-plugins.php): failed to open stream: No such file or directory in wp-content/plugins/gd-security-headers/forms/about/dev4press.php on line 1
    • > PHP Warning
      include(): Failed opening 'GDSIH_PATHforms/about/minor.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/gd-security-headers/forms/about/whatsnew.php on line 1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/gd-security-headers/forms/dashboard/reports.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/gd-security-headers/forms/about/info.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/gd-security-headers/gd-security-headers.php:35
    • > PHP Warning
      Use of undefined constant GDSIH_D4PLIB - assumed 'GDSIH_D4PLIB' (this will throw an Error in a future version of PHP) in wp-content/plugins/gd-security-headers/forms/about/dev4press.php on line 1
    • > PHP Warning
      include(): Failed opening 'GDSIH_D4PLIBshared/d4p.about-plugins.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/gd-security-headers/forms/about/dev4press.php on line 1

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

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
9 plugin tags: csp, security headers, permission policy, dev4press, content security policy...

gd-security-headers/gd-security-headers.php 92% from 13 tests

The main PHP script in "GD Security Headers" version 1.7.1 is automatically included on every request by WordPress
You should first fix the following items:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 153 characters long)

Code Analysis Passed 3 tests

File types Passed 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
No dangerous file extensions were detected17,259 lines of code in 157 files:
LanguageFilesBlank linesComment linesLines of code
PHP1042,67080910,391
SVG2003,151
CSS25724383,138
JavaScript2612959579

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.43
Average class complexity15.00
▷ Minimum class complexity1.00
▷ Maximum class complexity113.00
Average method complexity2.73
▷ Minimum method complexity1.00
▷ Maximum method complexity58.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes66
▷ Abstract classes1218.18%
▷ Concrete classes5481.82%
▷ Final classes00.00%
Methods558
▷ Static methods213.76%
▷ Public methods41674.55%
▷ Protected methods6712.01%
▷ Private methods7513.44%
Functions141
▷ Named functions141100.00%
▷ Anonymous functions00.00%
Constants64
▷ Global constants2437.50%
▷ Class constants4062.50%
▷ Public constants40100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
1 PNG file occupies 0.08MB with 0.05MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
d4plib/resources/flags/flags.png79.53KB25.86KB▼ 67.48%