Security5 min readBy Metrotechs

v1.5.1: Security Hardening Across the Plugin

The v1.5.1 release is a focused security hardening update. No new features — just a thorough pass over every part of the plugin to tighten input handling, output escaping, AJAX protection, and privilege enforcement. For a plugin that operates inside the WordPress admin and makes direct database writes, this kind of audit is non-negotiable.

Input Sanitization

Every value accepted from user input or external sources across all sync pages — Full Sync, Product Sync, and Category Sync — now passes through appropriate WordPress sanitization functions. Text fields use sanitize_text_field(), integer values use intval(), and API keys are sanitized before being written to the options table. This closes the surface area for data injection before it reaches any processing logic.

Output Escaping

Output escaping has been hardened throughout the plugin to prevent XSS vulnerabilities. All values rendered into the DOM are now passed through the appropriate escaping function for their context: esc_html() for plain text, esc_attr() for HTML attributes, esc_url() for URLs, and wp_kses_post() where HTML is intentionally allowed. This applies to product names, descriptions, status messages, and any dynamic content rendered in the admin interface.

Nonce Verification on AJAX Endpoints

All AJAX endpoints in the plugin are now protected by strengthened nonce verification. Nonces are verified at the start of every handler before any processing occurs, and the verification failure path halts execution immediately with wp_die(). This prevents cross-site request forgery attacks from tricking an authenticated admin into triggering sync operations or writing data without their knowledge.

Capability Checks

Capability checks using current_user_can('manage_options') are now enforced consistently throughout the plugin — on every AJAX handler, every settings write, and every admin page load. Previously, some code paths relied on the admin menu registration to restrict access implicitly. All access control is now explicit and checked at the point of execution.

Uninstall Routine

The plugin's uninstall routine has been secured against unauthorized execution. The uninstall.php file now verifies both WP_UNINSTALL_PLUGIN and that the request originates from a user with manage_options capability before proceeding with cleanup. This prevents the routine from being triggered directly or from non-plugin-manager contexts, which could otherwise be used to wipe plugin data without authorization.

v1.5.1 is fully backwards-compatible — no settings, no data, and no sync behavior changes. Download the latest release from the GitHub repository.

All Posts