diff --git a/changelog.txt b/changelog.txt index c55e23f..849c0d6 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,76 @@ == Changelog == += 1.6.11 = + +_Release date: 2026-11-04_ + +**Fixed** + +* The 2FA verification screen is no longer hijacked on membership sites that redirect the WordPress login away from wp-login.php (confirmed live on Restrict Content Pro 4.0.9 with "Hijack Login URL" enabled and the login at a custom account page such as /mi-cuenta/). RCP implements the hijack twice: through the login_url filter (already handled since 1.6.4) and — new finding — through a `login_form_login` redirect that bounces every default-action wp-login.php request to the membership page, dropping the 2FA query arguments. Stage requests now carry a dedicated `action=robotstxt-2fa-verify` (declared to WordPress via a registered `login_form_` hook, preserved on submission through a hidden field), so they run core's login branch without firing `login_form_login`, out of reach of that redirect pattern in any plugin. Verified end to end on the reported replica: password at the membership page → verification screen renders → valid code → user lands back on the membership page, logged in. +* Users logging in from front-end forms (membership/account pages) now return to the page they logged in from after completing 2FA instead of landing in wp-admin: when the request carries no core `redirect_to`, the challenge falls back to the raw HTTP referer, validated to be same-host and not an admin or login URL (foreign and admin referers are ignored). + +**Compatibility** + +* WordPress: 7.0 - 7.2 +* PHP: 8.3 - 8.6 + +**Tests** + +* PHP Coding Standards: PHP_CodeSniffer 3.13.6 / WPCS 3.4.1 — 0 errors +* PHPStan: level max (10), no baseline — 0 errors +* PHPCompatibility: 8.3-8.6 — 0 issues +* PHPUnit: 9.6.38 — 125 tests, 236 assertions (PHP 8.6.0RC3 and 8.3.36) +* Live end-to-end on the reported site replica (WordPress 7.1.4 + Restrict Content Pro 4.0.9): full login → 2FA → return-to-page cycle, MariaDB 11.8.9 + += 1.6.10 = + +_Release date: 2026-11-03_ + +**Fixed** + +* The 2FA verification stage now stays on the login URL the visitor actually used. When wp-login.php executes through an alias or renamed slug (a `/login` rewrite, a "hidden login" setup that does not filter `site_url`), the post-password redirect previously always targeted the literal `/wp-login.php` — on sites where that URL is blocked or renamed away at server level, users were stranded on a 403/404 page right after a correct password. The stage base URL now preserves the executing login surface (path only; host and scheme still come from the site's canonical URL; traversal sequences rejected), while logins submitted from custom pages calling `wp_signon()` keep landing on the real wp-login.php as before (the 1.6.4 Restrict Content Pro guarantee). Full root-cause analysis in `docs/report-login-surface-urls.md`. + +**Compatibility** + +* WordPress: 7.0 - 7.2 +* PHP: 8.3 - 8.6 + +**Tests** + +* PHP Coding Standards: PHP_CodeSniffer 3.13.6 / WPCS 3.4.1 — 0 errors +* PHPStan: level max (10), no baseline — 0 errors +* PHPCompatibility: 8.3-8.6 — 0 issues +* PHPUnit: 9.6.38 — 119 tests, 229 assertions (PHP 8.6.0RC3 and 8.3.36) +* Live surface probes: WordPress 7.2-beta4 (single site) and WordPress 7.0 (multisite) on PHP 8.6.0RC3, MariaDB 11.8.9 + += 1.6.9 = + +_Release date: 2026-11-03_ + +**Changed** + +* Compatibility floors raised: minimum WordPress moved from 5.6 to 7.0 and minimum PHP from 8.0 to 8.3, matching the support policy (latest stable WordPress plus the two previous majors). The full-range compatibility review (WordPress 4.7-7.2 walked down with wp-compat; PHP 5.6-8.6 scanned with PHPCompatibility) confirmed the plugin uses no WordPress symbols newer than 6.0 and no PHP syntax newer than 8.0, so the real code floors are lower — the declared floors are the supported ones. WordPress 7.2 (beta 4, single-site) and WordPress 7.0 (multisite) were live-tested; PHP 8.6 (RC 3) was live-tested and PHP 8.3-8.6 scanned clean. +* The admin menu icon is now a brand SVG (shield with keyhole, base64 data URI) instead of `dashicons-shield`, on both single-site and network admin menus. WordPress core natively renders base64 SVG menu icons (centered at 20px), so the icon works identically on WordPress 7.0, 7.1 and 7.2, stays crisp on high-density screens, and is future-proof against the admin-wide move from Dashicons to SVG icons tracked in WordPress core (PR #12270 / Trac ticket #65089). Dashicons continue to work everywhere else. +* Composer tooling updated: wp-compat 3.0.1, PHPStan 2.3.5, wordpress-stubs 7.1.2, PHPUnit 9.6.38, maxmind-db/reader 1.14.0; `composer audit` reports no known vulnerabilities. + +**Fixed** + +* PHP 8.6 deprecation removed: the REST controller declared a class constant named `namespace` (case-insensitively), which PHP 8.6 deprecates and PHP 9 will reject as a fatal error. Renamed to `REST_NAMESPACE` with no functional change (the constant was private). +* Static-analysis hardening to pass PHPStan at the new maximum level (10) without a baseline: `$wpdb`, `$wp_filter` and `$post` globals are now properly typed; the uninstall routine deletes user meta through the `$wpdb->delete()` WordPress API instead of hand-built SQL; role names from `get_editable_roles()` are validated before translation; `AUTH_SALT` and `COOKIEPATH` are validated as strings before use in the trusted-device cookie; the trusted-device map discards corrupted non-string keys; `get_users()` results are instance-checked before use; a misplaced translators comment on an `_n()` call was fixed (WPCS error). + +**Compatibility** + +* WordPress: 7.0 - 7.2 +* PHP: 8.3 - 8.6 + +**Tests** + +* PHP Coding Standards: PHP_CodeSniffer 3.13.6 / WPCS 3.4.1 — 0 errors, 1 accepted advisory warning (urlencode mirrors WordPress core's wp_login_url()) +* PHPStan: 2.3.5 level max (10), no baseline — 0 errors +* PHPCompatibility: 9.3.5, testVersion 8.3-8.6 — 0 issues +* PHPUnit: 9.6.38 — 110 tests, 220 assertions (PHP 8.6.0RC3 and PHP 8.3.36) +* Live smoke tests: WordPress 7.2-beta4 (single site) and WordPress 7.0 (multisite) on PHP 8.6.0RC3, MariaDB 11.8.9 + = 1.6.8 = _Release date: 2026-09-21_ diff --git a/includes/admin/class-dashboard-page.php b/includes/admin/class-dashboard-page.php index fdf4b09..7517c0e 100644 --- a/includes/admin/class-dashboard-page.php +++ b/includes/admin/class-dashboard-page.php @@ -24,6 +24,18 @@ class Dashboard_Page { */ public const PAGE_SLUG = 'robotstxt-2fa-dashboard'; + /** + * Brand SVG menu icon (shield with keyhole) as a base64 data URI. + * + * WordPress core renders base64-encoded SVG data URIs natively in admin + * menus (centered at 20px via the .wp-menu-image.svg CSS class), which + * keeps the icon crisp and independent of the Dashicons font while + * remaining fully backward compatible. + * + * @since 1.6.9 + */ + public const MENU_ICON = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgdmlld0JveD0iMCAwIDIwIDIwIiByb2xlPSJpbWciIGFyaWEtaGlkZGVuPSJ0cnVlIiBmb2N1c2FibGU9ImZhbHNlIj48cGF0aCBmaWxsPSIjMDM4N2M5IiBkPSJNMTAgMSAxOCAzLjl2NS4zYzAgNS40LTMuMyA4LjYtOCA5LjgtNC43LTEuMi04LTQuNC04LTkuOFYzLjlaIi8+PGNpcmNsZSBjeD0iMTAiIGN5PSI4IiByPSIyLjIiIGZpbGw9IiNmZmVmZDQiLz48cGF0aCBmaWxsPSIjZmZlZmQ0IiBkPSJNOC44IDkuOSA3LjYgMTMuN2g0LjhMMTEuMiA5LjlaIi8+PC9zdmc+'; + /** * Failed attempts log. * @@ -108,7 +120,7 @@ class Dashboard_Page { 'manage_options', self::PAGE_SLUG, array( $this, 'render_page' ), - 'dashicons-shield' + self::MENU_ICON ); add_submenu_page( diff --git a/includes/admin/class-migration-page.php b/includes/admin/class-migration-page.php index d4456c2..91c6aa3 100644 --- a/includes/admin/class-migration-page.php +++ b/includes/admin/class-migration-page.php @@ -538,6 +538,11 @@ class Migration_Page { * @return array */ private function get_candidates_from_wordfence(): array { + /** + * WordPress database abstraction. Typed for PHPStan level max. + * + * @var \wpdb $wpdb + */ global $wpdb; $table = $wpdb->prefix . self::WORDFENCE_TABLE; @@ -550,21 +555,17 @@ class Migration_Page { return array(); } - // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table names are trusted constants. + // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name is a trusted prefix constant; the user ID is a validated integer. $rows = $wpdb->get_results( "SELECT s.user_id, s.secret FROM `{$table}` s", ARRAY_A ); // phpcs:enable WordPress.DB.PreparedSQL.InterpolatedNotPrepared - if ( ! is_array( $rows ) ) { - return array(); - } - $candidates = array(); foreach ( $rows as $row ) { - if ( ! is_array( $row ) || ! isset( $row['user_id'] ) || ! is_numeric( $row['user_id'] ) ) { + if ( ! isset( $row['user_id'] ) || ! is_numeric( $row['user_id'] ) ) { continue; } @@ -716,14 +717,19 @@ class Migration_Page { * @return string */ private function read_wordfence_secret( int $user_id ): string { + /** + * WordPress database abstraction. Typed for PHPStan level max. + * + * @var \wpdb $wpdb + */ global $wpdb; $table = $wpdb->prefix . self::WORDFENCE_TABLE; - // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name is a trusted constant. - $secret_binary = $wpdb->get_var( $wpdb->prepare( "SELECT `secret` FROM `{$table}` WHERE `user_id` = %d LIMIT 1", $user_id ) ); + // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name is a trusted prefix constant; the user ID is a validated integer. + $secret_binary = $wpdb->get_var( "SELECT `secret` FROM `{$table}` WHERE `user_id` = {$user_id} LIMIT 1" ); - if ( ! is_string( $secret_binary ) || '' === $secret_binary ) { + if ( ! is_string( $secret_binary ) ) { return ''; } diff --git a/includes/admin/class-settings-page.php b/includes/admin/class-settings-page.php index 904a7c4..94c9036 100644 --- a/includes/admin/class-settings-page.php +++ b/includes/admin/class-settings-page.php @@ -431,8 +431,13 @@ class Settings_Page { $role_details ) : ?> + - + $method_label ) : ?>