v1.6.10
This commit is contained in:
parent
7379505d20
commit
b81db2d302
5 changed files with 100 additions and 15 deletions
|
|
@ -1,5 +1,26 @@
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
|
||||||
|
= 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 =
|
= 1.6.9 =
|
||||||
|
|
||||||
_Release date: 2026-11-03_
|
_Release date: 2026-11-03_
|
||||||
|
|
|
||||||
|
|
@ -259,14 +259,20 @@ class Login_Form_Manager {
|
||||||
* login_init hook when wp-login.php itself loads. This mirrors the URL
|
* login_init hook when wp-login.php itself loads. This mirrors the URL
|
||||||
* construction wp_login_url() performs before its filter runs.
|
* construction wp_login_url() performs before its filter runs.
|
||||||
*
|
*
|
||||||
|
* When wp-login.php executes through a different URL (a /login rewrite,
|
||||||
|
* a renamed "hidden login" slug), the stage keeps using that same URL so
|
||||||
|
* the verification screen stays reachable on sites that block the literal
|
||||||
|
* wp-login.php address. See get_stage_base_url().
|
||||||
|
*
|
||||||
* @since 1.6.4
|
* @since 1.6.4
|
||||||
|
* @since 1.6.10 Preserves the login surface currently in use when wp-login.php executes through an alias.
|
||||||
*
|
*
|
||||||
* @param string $redirect_to Optional redirect_to value to carry over.
|
* @param string $redirect_to Optional redirect_to value to carry over.
|
||||||
*
|
*
|
||||||
* @return string Absolute wp-login.php URL with optional redirect_to parameter.
|
* @return string Absolute login URL with optional redirect_to parameter.
|
||||||
*/
|
*/
|
||||||
public static function get_canonical_login_url( string $redirect_to = '' ): string {
|
public static function get_canonical_login_url( string $redirect_to = '' ): string {
|
||||||
$url = site_url( 'wp-login.php', 'login' );
|
$url = self::get_stage_base_url();
|
||||||
|
|
||||||
if ( '' !== $redirect_to ) {
|
if ( '' !== $redirect_to ) {
|
||||||
$url = add_query_arg( 'redirect_to', urlencode( $redirect_to ), $url );
|
$url = add_query_arg( 'redirect_to', urlencode( $redirect_to ), $url );
|
||||||
|
|
@ -275,6 +281,64 @@ class Login_Form_Manager {
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the base login URL the 2FA stage should navigate on.
|
||||||
|
*
|
||||||
|
* Priority order:
|
||||||
|
*
|
||||||
|
* 1. The URL the visitor actually used, when wp-login.php is the executing
|
||||||
|
* script but was reached through an alias or renamed slug (server
|
||||||
|
* rewrites such as /login, "hide login" plugins). Keeping the stage on
|
||||||
|
* the reachable surface avoids redirecting users to a blocked or
|
||||||
|
* rewritten-away wp-login.php URL after a correct password.
|
||||||
|
* 2. The canonical wp-login.php URL (site_url), which remains filterable
|
||||||
|
* by plugins that rewrite it, and which is always used when credentials
|
||||||
|
* were submitted from a custom page calling wp_signon() — the
|
||||||
|
* login_init hook does not fire there, and the verification form only
|
||||||
|
* renders on wp-login.php.
|
||||||
|
*
|
||||||
|
* The path from the current request is only trusted when wp-login.php is
|
||||||
|
* actually executing (login_init fired), traversal sequences are
|
||||||
|
* rejected, and only the path is reused — host and scheme always come
|
||||||
|
* from the site's own canonical URL.
|
||||||
|
*
|
||||||
|
* @since 1.6.10
|
||||||
|
*
|
||||||
|
* @return string Absolute login URL without any 2FA query arguments.
|
||||||
|
*/
|
||||||
|
private static function get_stage_base_url(): string {
|
||||||
|
$canonical = site_url( 'wp-login.php', 'login' );
|
||||||
|
|
||||||
|
if ( ! did_action( 'login_init' ) ) {
|
||||||
|
return $canonical;
|
||||||
|
}
|
||||||
|
|
||||||
|
$request_uri = isset( $_SERVER['REQUEST_URI'] ) && is_string( $_SERVER['REQUEST_URI'] )
|
||||||
|
? $_SERVER['REQUEST_URI']
|
||||||
|
: '';
|
||||||
|
|
||||||
|
$request_path = wp_parse_url( $request_uri, PHP_URL_PATH );
|
||||||
|
|
||||||
|
if ( ! is_string( $request_path ) ) {
|
||||||
|
return $canonical;
|
||||||
|
}
|
||||||
|
|
||||||
|
$request_path = rawurldecode( $request_path );
|
||||||
|
|
||||||
|
// Reject traversal attempts in both raw and percent-encoded form.
|
||||||
|
if ( str_contains( $request_path, '..' ) ) {
|
||||||
|
return $canonical;
|
||||||
|
}
|
||||||
|
|
||||||
|
$canonical_path = wp_parse_url( $canonical, PHP_URL_PATH );
|
||||||
|
|
||||||
|
if ( ! is_string( $canonical_path ) || '' === $canonical_path || $request_path === $canonical_path ) {
|
||||||
|
return $canonical;
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_replace( $canonical_path, $request_path, $canonical );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable the ALTCHA Spam Protection login interceptor during the 2FA stage.
|
* Disable the ALTCHA Spam Protection login interceptor during the 2FA stage.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
18
readme.txt
18
readme.txt
|
|
@ -4,7 +4,7 @@ Tags: security, two-factor authentication, login, otp
|
||||||
Requires at least: 7.0
|
Requires at least: 7.0
|
||||||
Tested up to: 7.2
|
Tested up to: 7.2
|
||||||
Requires PHP: 8.3
|
Requires PHP: 8.3
|
||||||
Stable tag: 1.6.9
|
Stable tag: 1.6.10
|
||||||
License: GPLv3 or later
|
License: GPLv3 or later
|
||||||
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
|
||||||
|
|
@ -59,6 +59,14 @@ Yes. Activate the plugin at the network level. Network administrators can set an
|
||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
|
||||||
|
= 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. Logins submitted from custom pages keep landing on the real wp-login.php as before.
|
||||||
|
|
||||||
= 1.6.9 =
|
= 1.6.9 =
|
||||||
|
|
||||||
_Release date: 2026-11-03_
|
_Release date: 2026-11-03_
|
||||||
|
|
@ -96,14 +104,6 @@ _Release date: 2026-09-21_
|
||||||
|
|
||||||
* "We could not determine which account you are trying to access" during verification: the pending-stage token was stored in a transient, which external object caches (Redis/Memcached) can evict at any time, killing live verification sessions. Tokens now live in a persistent option map and the error message asks the user to sign in again.
|
* "We could not determine which account you are trying to access" during verification: the pending-stage token was stored in a transient, which external object caches (Redis/Memcached) can evict at any time, killing live verification sessions. Tokens now live in a persistent option map and the error message asks the user to sign in again.
|
||||||
|
|
||||||
= 1.6.7 =
|
|
||||||
|
|
||||||
_Release date: 2026-09-17_
|
|
||||||
|
|
||||||
**Fixed**
|
|
||||||
|
|
||||||
* The forced-setup wizard felt like a broken redirect loop: the wizard redirect bounced users to the profile with no explanation (it now carries a flag that renders a clear "activate at least one verification method, then save" warning), and saving with an expired form nonce silently did nothing (it now raises a visible "form session expired" error so users know to try again).
|
|
||||||
|
|
||||||
= Previous versions =
|
= Previous versions =
|
||||||
|
|
||||||
For the full changelog see the [changelog](https://www.robotstxt.software/plugins/robotstxt-2fa/) page.
|
For the full changelog see the [changelog](https://www.robotstxt.software/plugins/robotstxt-2fa/) page.
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
* Plugin URI: https://www.robotstxt.software/plugins/robotstxt-2fa/
|
* Plugin URI: https://www.robotstxt.software/plugins/robotstxt-2fa/
|
||||||
* Update URI: https://www.robotstxt.software/plugins/robotstxt-2fa/
|
* Update URI: https://www.robotstxt.software/plugins/robotstxt-2fa/
|
||||||
* Description: Adds two-factor authentication to the WordPress login flow.
|
* Description: Adds two-factor authentication to the WordPress login flow.
|
||||||
* Version: 1.6.9
|
* Version: 1.6.10
|
||||||
* Author: ROBOTSTXT
|
* Author: ROBOTSTXT
|
||||||
* Author URI: https://www.robotstxt.software/
|
* Author URI: https://www.robotstxt.software/
|
||||||
* Text Domain: robotstxt-2fa
|
* Text Domain: robotstxt-2fa
|
||||||
|
|
@ -25,7 +25,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! defined( 'ROBOTSTXT_2FA_VERSION' ) ) {
|
if ( ! defined( 'ROBOTSTXT_2FA_VERSION' ) ) {
|
||||||
define( 'ROBOTSTXT_2FA_VERSION', '1.6.9' );
|
define( 'ROBOTSTXT_2FA_VERSION', '1.6.10' );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! defined( 'ROBOTSTXT_2FA_FILE' ) ) {
|
if ( ! defined( 'ROBOTSTXT_2FA_FILE' ) ) {
|
||||||
|
|
|
||||||
4
vendor/composer/installed.php
vendored
4
vendor/composer/installed.php
vendored
|
|
@ -3,7 +3,7 @@
|
||||||
'name' => 'robotstxt/robotstxt-2fa',
|
'name' => 'robotstxt/robotstxt-2fa',
|
||||||
'pretty_version' => 'dev-main',
|
'pretty_version' => 'dev-main',
|
||||||
'version' => 'dev-main',
|
'version' => 'dev-main',
|
||||||
'reference' => '540212fa49599418676da0d91e03bac2acb6c60a',
|
'reference' => '75d6bdce967002e99e4a4c21df2088277a905e90',
|
||||||
'type' => 'wordpress-plugin',
|
'type' => 'wordpress-plugin',
|
||||||
'install_path' => __DIR__ . '/../../',
|
'install_path' => __DIR__ . '/../../',
|
||||||
'aliases' => array(),
|
'aliases' => array(),
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
'robotstxt/robotstxt-2fa' => array(
|
'robotstxt/robotstxt-2fa' => array(
|
||||||
'pretty_version' => 'dev-main',
|
'pretty_version' => 'dev-main',
|
||||||
'version' => 'dev-main',
|
'version' => 'dev-main',
|
||||||
'reference' => '540212fa49599418676da0d91e03bac2acb6c60a',
|
'reference' => '75d6bdce967002e99e4a4c21df2088277a905e90',
|
||||||
'type' => 'wordpress-plugin',
|
'type' => 'wordpress-plugin',
|
||||||
'install_path' => __DIR__ . '/../../',
|
'install_path' => __DIR__ . '/../../',
|
||||||
'aliases' => array(),
|
'aliases' => array(),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue