84% baw-anti-csrf

Code Review | Anti CSRF

WordPress plugin Anti CSRF scored84%from 54 tests.

About plugin

  • Plugin page: baw-anti-csrf
  • Plugin version: 1.5.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.1-3.6
  • WordPress version: 6.3.1
  • First release: Aug 12, 2012
  • Latest release: Sep 12, 2013
  • Number of updates: 18
  • Update frequency: every 22.4 days
  • Top authors: juliobox (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

80+ active /8,587 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲0.08MB] [CPU: ▼2.03ms] Passed 4 tests

An overview of server-side resources used by Anti CSRF
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0339.25 ▼2.29
Dashboard /wp-admin3.47 ▲0.1751.97 ▲4.83
Posts /wp-admin/edit.php3.46 ▲0.1043.81 ▼3.90
Add New Post /wp-admin/post-new.php5.92 ▲0.0382.72 ▼6.75
Media Library /wp-admin/upload.php3.46 ▲0.2239.19 ▲6.87

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

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 4 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
theysaidso_admin_options
can_compress_scripts
widget_recent-comments
db_upgraded
widget_theysaidso_widget

Browser metrics Passed 4 tests

Anti CSRF: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,809 ▲6314.23 ▼0.211.75 ▼0.0445.75 ▲0.91
Dashboard /wp-admin2,215 ▲275.80 ▼0.03101.32 ▼3.0341.46 ▲0.32
Posts /wp-admin/edit.php2,089 ▼02.00 ▼0.0634.42 ▼1.6431.36 ▼3.27
Add New Post /wp-admin/post-new.php1,533 ▼923.37 ▲5.19683.55 ▲53.9570.99 ▲10.39
Media Library /wp-admin/upload.php1,391 ▲64.31 ▲0.12102.38 ▼0.7143.62 ▼0.00

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
It is recommended to fix the following
  • Zombie WordPress options detected upon uninstall: 6 options
    • db_upgraded
    • widget_recent-posts
    • widget_recent-comments
    • can_compress_scripts
    • widget_theysaidso_widget
    • theysaidso_admin_options

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

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
The following issues need your attention
  • 1× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_admin() in wp-content/plugins/baw-anti-csrf/bawac.php:14

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
There were no browser issues found

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
4 plugin tags: csrf, vulnerability, security, xsrf

baw-anti-csrf/bawac.php 92% from 13 tests

Analyzing the main PHP file in "Anti CSRF" version 1.5.2
It is important to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("baw-anti-csrf.php" instead of "bawac.php")

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
There were no executable files found in this plugin151 lines of code in 2 files:
LanguageFilesBlank linesComment linesLines of code
PHP1139113
PO File1111738

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.49
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions6
▷ Named functions6100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
There were not PNG files found in your plugin