78% wp-content-security-policy

Code Review | WP Content Security Plugin

WordPress plugin WP Content Security Plugin scored78%from 54 tests.

About plugin

  • Plugin page: wp-content-securi...
  • Plugin version: 2.3
  • PHP compatiblity: 5.3+
  • PHP version: 7.4.16
  • WordPress version: 6.3.1
  • First release: Aug 16, 2015
  • Latest release: Feb 10, 2018
  • Number of updates: 20
  • Update frequency: every 45.9 days
  • Top authors: dyland (100%)

Code review

54 tests

User reviews

14 reviews

Install metrics

2,000+ active /30,622 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
This plugin's installer ran successfully

Server metrics [RAM: ▼0.54MB] [CPU: ▼20.72ms] Passed 4 tests

Analyzing server-side resources used by WP Content Security Plugin
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.12 ▼0.3419.34 ▼18.86
Dashboard /wp-admin3.60 ▲0.3051.84 ▲0.80
Posts /wp-admin/edit.php3.72 ▲0.3650.21 ▼1.93
Add New Post /wp-admin/post-new.php3.48 ▼2.4138.25 ▼62.90
Media Library /wp-admin/upload.php3.52 ▲0.3037.57 ▲3.84
CSP Options /wp-admin/options-general.php?page=wpcsp_options3.6042.74
CSP Log /wp-admin/options-general.php?page=wpcsp_log3.4935.01

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

A short overview of filesystem and database impact
This plugin installed successfully
Filesystem: 13 new files
Database: 1 new table, 7 new options
New tables
wp_wpcsplog
New WordPress options
theysaidso_admin_options
wpcsp-dbVersion
db_upgraded
widget_recent-comments
widget_theysaidso_widget
can_compress_scripts
widget_recent-posts

Browser metrics Passed 4 tests

WP Content Security Plugin: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,939 ▲19313.79 ▼0.608.03 ▲6.3139.91 ▼7.72
Dashboard /wp-admin2,223 ▲325.93 ▲1.00108.89 ▼6.8638.90 ▼6.16
Posts /wp-admin/edit.php2,106 ▲172.10 ▲0.1342.80 ▲6.8935.44 ▼0.92
Add New Post /wp-admin/post-new.php1,537 ▲423.12 ▼0.19683.14 ▲23.6658.95 ▲5.05
Media Library /wp-admin/upload.php1,399 ▲144.30 ▲0.0699.06 ▼4.2842.33 ▼4.14
CSP Options /wp-admin/options-general.php?page=wpcsp_options2,4442.0335.4053.70
CSP Log /wp-admin/options-general.php?page=wpcsp_log8231.8024.3726.54

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-posts
    • can_compress_scripts

Smoke tests 50% 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)
Even though no errors were found, this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Almost there! Just fix the following items
  • 4× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/wp-content-security-policy/wp-content-security-policy.php
    • > /wp-content/plugins/wp-content-security-policy/admin/WP_CSP_Admin.php
    • > /wp-content/plugins/wp-content-security-policy/admin/part-cspv3.php
    • > /wp-content/plugins/wp-content-security-policy/includes/WP_CSP.php
  • 5× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/wp-content-security-policy/admin/part-cspsavechanges.php:1
    • > PHP Fatal error
      Uncaught Error: Class 'WP_CSP' not found in wp-content/plugins/wp-content-security-policy/admin/part-cspoptions.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/wp-content-security-policy/admin/part-csptest.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/wp-content-security-policy/admin/part-cspheaders.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'WP_CSP' not found in wp-content/plugins/wp-content-security-policy/admin/part-cspcontrol.php:6

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser errors were detected

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
Attributes that require attention:
  • Donate link: Invalid URI ("None")
You can look at the official readme.txt

wp-content-security-policy/wp-content-security-policy.php 92% from 13 tests

The entry point to "WP Content Security Plugin" version 2.3 is a PHP file that has certain tags in its header comment area
The following require your attention:
  • Domain Path: The domain path points to an invalid folder, "/languages" does not exist

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Everything looks great! No dangerous files found in this plugin2,292 lines of code in 12 files:
LanguageFilesBlank linesComment linesLines of code
PHP102342932,025
JavaScript1232169
CSS13098

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.37
Average class complexity137.00
▷ Minimum class complexity101.00
▷ Maximum class complexity173.00
Average method complexity8.16
▷ Minimum method complexity1.00
▷ Maximum method complexity69.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods38
▷ Static methods3694.74%
▷ Public methods3284.21%
▷ Protected methods00.00%
▷ Private methods615.79%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants46
▷ Global constants00.00%
▷ Class constants46100.00%
▷ Public constants46100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
No PNG images were found in this plugin