From a50d12588331941b5b5b8881410ee219c2777035 Mon Sep 17 00:00:00 2001 From: Javier Casares Date: Tue, 3 Nov 2026 16:59:54 +0000 Subject: [PATCH] v3.1.5 --- changelog.txt | 42 ++++++++++++++++++++++++++++++++++++++++++ noindex-seo.php | 27 ++++++++++++++++----------- readme.txt | 20 ++++++++++---------- 3 files changed, 68 insertions(+), 21 deletions(-) diff --git a/changelog.txt b/changelog.txt index 5735f5d..0cf898f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,47 @@ == Changelog == += 3.1.5 = + +_Release date: 2026-09-18_ + +**Highlights** + +* Maintenance review: composer update, code review, security review and compatibility review (WordPress 4.7 - 7.2, PHP 5.6 - 8.5). Declared WordPress floor corrected to the real tested minimum (4.7). Test suite expanded to 147 tests with 94.78% line coverage, meeting the 80% AGENTS target. + +**Added** + +* 76 new PHPUnit tests: front-end output (`noindex_seo_metarobots`, all major `noindex_seo_show` contexts, overrides, CPT defaults, transient shortcut), admin surface (settings page, meta boxes, Quick Edit, bulk actions, columns, filters, enqueues, conflict detection, helpers), sitemap per-term exclusion, and uninstall cleanup. + +**Changed** + +* Minimum WordPress requirement raised from 4.0 to 4.7 in the plugin header, `readme.txt` and `phpcs.xml` (`minimum_supported_wp_version`). Version 4.7 is the oldest release in the tested range and the first with the complete REST API, so every advertised feature (including the `/wp-json/noindex-seo/v1/` endpoints) is available on all supported versions. Newer-API integrations keep degrading gracefully above the floor (`wp_robots` 5.7+, sitemaps 5.5+, block editor 5.0+, `register_post_meta`, term meta). +* Tested up to WordPress 7.2 in `readme.txt`. +* Removed three now-obsolete `WPCompat` PHPStan ignores (`rest_api_init` action, `WP_REST_Request::get_param()` × 2): with the 4.7 floor those APIs always exist, and PHPStan reports unmatched ignores as errors. +* Dev dependencies updated via `composer update` (`phpstan/phpstan` 2.2.8 → 2.2.14, `nikic/php-parser` 5.8.0 → 5.9.0, `php-stubs/wordpress-stubs` 6.9.4 → 7.1.0, `szepeviktor/phpstan-wordpress` 2.0.3 → 2.0.4, `wp-hooks/wordpress-core` 1.12.0 → 1.13.0). No production code ships these packages. +* Coverage regression floor in `bin/preflight.sh` raised from 25% to 80% now that the suite meets the AGENTS target. + +**Fixed** + +* Dead nonce check in `noindex_seo_process_form()` and `noindex_seo_process_apply_suggestions()`: `! check_admin_referer()` with a specific action can never be true (the function exits on failure instead of returning false), so the `||` branch was dead code flagged by PHPStan level 9 with the updated WordPress stubs. Both handlers now check `current_user_can( 'manage_options' )` first and call `check_admin_referer()` separately, which dies on an invalid nonce. No behavior change for valid requests. + +**Security** + +* Full canonical checklist (`AGENTS-security.md`) reviewed against the release diff: no findings. Input validation (safelist + strict types), sanitization (`sanitize_text_field`, `absint`, `sanitize_key`), late output escaping, nonces on every state-changing action, capability checks in UI and execution logic, `$wpdb->prepare()` on all custom SQL, no dangerous functions, REST `permission_callback`s intact, no secrets in code. `composer audit` clean. +* The nonce-handler fix above is hardening only: the previous code was still safe in practice because `check_admin_referer()` dies on failure. + +**Compatibility** + +* WordPress: 4.7 - 7.2 +* PHP: 5.6 - 8.5 + +**Tests** + +* PHP Coding Standards: 3.13.6 +* WordPress Coding Standards: 3.4.1 +* PHPUnit: 9.6.36 (147 tests, 569 assertions — all passing on WordPress 7.1.1 test library; staging site runs WordPress 7.2-alpha, PHP 8.5.10, MariaDB 11.8.9) +* PHPCompatibility 5.6-8.5 scan: clean (declared PHP floor 5.6 confirmed) +* PHPStan level 9: clean; `bin/preflight.sh`: full PASS (coverage 94.78%, above the 80% AGENTS target and floor) + = 3.1.3 = _Release date: 2026-08-17_ diff --git a/noindex-seo.php b/noindex-seo.php index b5df218..845b80f 100644 --- a/noindex-seo.php +++ b/noindex-seo.php @@ -3,8 +3,8 @@ * Plugin Name: noindex SEO * Plugin URI: https://www.robotstxt.software/plugins/noindex-seo/ * Description: Control search engine indexing with robots directives (noindex, nofollow, noarchive, nosnippet, noimageindex) for specific parts of your WordPress site. - * Version: 3.1.3 - * Requires at least: 4.0 + * Version: 3.1.5 + * Requires at least: 4.7 * Requires PHP: 5.6 * Author: ROBOTSTXT * Author URI: https://www.robotstxt.software/ @@ -60,8 +60,12 @@ defined( 'ABSPATH' ) || die( 'Bye bye!' ); * without the wp_robots API, and every newer-API integration * degrades gracefully). Branding moved to robotstxt.software * (Plugin URI / Author URI). + * @since 3.1.5 Maintenance review: WordPress floor corrected to 4.7 (the + * oldest tested version and the first with the complete REST + * API); nonce verification in the form handlers split into a + * capability check plus a standalone check_admin_referer(). */ -define( 'NOINDEX_SEO_VERSION', '3.1.3' ); +define( 'NOINDEX_SEO_VERSION', '3.1.5' ); /** * Option key holding the consolidated plugin settings array. @@ -1040,8 +1044,7 @@ function noindex_seo_register_rest_routes() { ) ); } -// The action only exists on WP 4.4+; on older versions it simply never fires. -/* @phpstan-ignore WPCompat.actionNotAvailable.restapiinit */ +// The rest_api_init action exists on all supported versions (floor: WP 4.7). add_action( 'rest_api_init', 'noindex_seo_register_rest_routes' ); /** @@ -1093,8 +1096,6 @@ function noindex_seo_rest_settings_permission_check() { * @return true|WP_Error True if access is allowed, WP_Error otherwise. */ function noindex_seo_rest_effective_permission_check( WP_REST_Request $request ) { - // get_param() exists since WP 4.4 and this callback is only registered on WP 4.7+ (see route registration guard). - /* @phpstan-ignore WPCompat.methodNotAvailable */ $raw_post_id = $request->get_param( 'post_id' ); $post_id = is_numeric( $raw_post_id ) ? (int) $raw_post_id : 0; $post = get_post( $post_id ); @@ -1163,8 +1164,6 @@ function noindex_seo_rest_get_settings() { * @return WP_REST_Response The effective-directives payload. */ function noindex_seo_rest_get_effective( WP_REST_Request $request ) { - // get_param() exists since WP 4.4 and this callback is only registered on WP 4.7+ (see route registration guard). - /* @phpstan-ignore WPCompat.methodNotAvailable */ $raw_post_id = $request->get_param( 'post_id' ); $post_id = is_numeric( $raw_post_id ) ? (int) $raw_post_id : 0; $post = get_post( $post_id ); @@ -1649,13 +1648,17 @@ add_action( 'admin_init', 'noindex_seo_detect_conflicts' ); * * @since 1.2.0 * @since 2.0.0 Added support for multiple directives (noindex, nofollow, noarchive, nosnippet, noimageindex). + * @since 3.1.5 Nonce verification split out of the capability check: + * check_admin_referer() dies on failure instead of returning + * false, so `! check_admin_referer()` was dead code. * * @return void */ function noindex_seo_process_form() { - if ( ! current_user_can( 'manage_options' ) || ! check_admin_referer( 'update_noindex_seo_nonce' ) ) { + if ( ! current_user_can( 'manage_options' ) ) { wp_die( esc_html__( 'Permission denied or invalid nonce.', 'noindex-seo' ) ); } + check_admin_referer( 'update_noindex_seo_nonce' ); $contexts = noindex_seo_get_contexts(); $directives = array( 'noindex', 'nofollow', 'noarchive', 'nosnippet', 'noimageindex' ); @@ -1748,13 +1751,15 @@ add_action( 'admin_post_update_noindex_seo', 'noindex_seo_process_form' ); * Hooked to the {@see 'admin_post_noindex_seo_apply_suggestions'} action. * * @since 3.0.0 + * @since 3.1.5 Same nonce-verification split as noindex_seo_process_form(). * * @return void */ function noindex_seo_process_apply_suggestions() { - if ( ! current_user_can( 'manage_options' ) || ! check_admin_referer( 'noindex_seo_apply_suggestions_nonce' ) ) { + if ( ! current_user_can( 'manage_options' ) ) { wp_die( esc_html__( 'Permission denied or invalid nonce.', 'noindex-seo' ) ); } + check_admin_referer( 'noindex_seo_apply_suggestions_nonce' ); $directives = array( 'noindex', 'nofollow', 'noarchive', 'nosnippet', 'noimageindex' ); $settings = noindex_seo_get_settings(); diff --git a/readme.txt b/readme.txt index f670a53..100c83a 100644 --- a/readme.txt +++ b/readme.txt @@ -1,11 +1,11 @@ === noindex SEO === Contributors: robotstxt, javiercasares Tags: seo, noindex, nofollow, noarchive, robots -Requires at least: 4.0 -Tested up to: 7.1 -Stable tag: 3.1.3 +Requires at least: 4.7 +Tested up to: 7.2 +Stable tag: 3.1.5 Requires PHP: 5.6 -Version: 3.1.3 +Version: 3.1.5 License: GPL-3.0-or-later License URI: https://www.gnu.org/licenses/gpl-3.0.txt @@ -134,11 +134,15 @@ No. By default all plugin data is preserved on uninstall. If you want a complete == Compatibility == -* WordPress: 4.0 - 7.1 +* WordPress: 4.7 - 7.2 * PHP: 5.6 - 8.5 == Changelog == += 3.1.5 = + +Maintenance review: WordPress floor corrected to 4.7 (oldest tested version, first with the complete REST API) and tested up to 7.2; nonce verification in the form handlers split into a capability check plus a standalone `check_admin_referer()`; dev dependencies updated; test suite expanded to 147 tests with 94.78% coverage. + = 3.1.3 = Compatibility release: WordPress 4.0+ and PHP 5.6+ supported again (the classic `` output covers WordPress versions without the `wp_robots` API, and every newer-API integration degrades gracefully). Branding moved to robotstxt.software. @@ -147,10 +151,6 @@ Compatibility release: WordPress 4.0+ and PHP 5.6+ supported again (the classic Audit-driven maintenance release: fixed the composer-audit gate in the preflight script, un-nested the settings page forms, added `load_plugin_textdomain()` for the bundled translations, pinned all dev dependencies, wired up coverage measurement. -= 3.1.1 = - -Security: tightened the ACL on the REST endpoints. `/settings` now requires `manage_options`; `/effective` is public only for published, non-password-protected posts and requires `edit_post` for everything else. - = Previous versions = If you want to see the full changelog, visit the [noindex SEO plugin page](https://www.robotstxt.software/plugins/noindex-seo/). @@ -171,6 +171,6 @@ This plugin adheres to the following security measures and review protocols for == Vulnerabilities == -* No vulnerabilities have been published up to version 3.1.3. +* No vulnerabilities have been published up to version 3.1.5. Found a security vulnerability? Please report it to us privately at the [noindex SEO GitHub repository](https://github.com/javiercasares/noindex-seo/security/advisories/new).