Making WordPress.org

Changeset 12238


Ignore:
Timestamp:
11/11/2022 05:02:59 AM (2 years ago)
Author:
dd32
Message:

Login: SSO: Fix an infinite login redirect when the destination url is https://example.org////wp-admin.

This causes wp_set_auth_cookie() to fail to set the /wp-admin cookie, as the browser will reject it due to the path mismatch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/common/includes/wporg-sso/class-wporg-sso.php

    r12237 r12238  
    237237            }
    238238
     239            /*
     240             * Collapse leading multiple slashes at the start of the path in the URL.
     241             * This can cause problems with setting cookies when the redirect is to
     242             * a SSO login destination such as `http://example.org//////wp-admin`.
     243             */
     244            $to = preg_replace( '!^(https?://[^/]+)/{2,}!', '$1/', $to );
     245
    239246            // In the event headers have been sent already, output a HTML redirect.
    240247            if ( headers_sent() ) {
Note: See TracChangeset for help on using the changeset viewer.