Make WordPress Core


Ignore:
Timestamp:
08/06/2026 07:56:28 PM (2 months ago)
Author:
desrosj
Message:

Security: Backport the WordPress 7.0.3 security fixes to the 4.9 branch.

  • Users: Ensure a proper email address is used before sending email confirmations.
  • Formatting: Prevent stack overflow in safecss_filter_attr.
  • Multisite: Enforce the active signup policy for existing users.
  • HTTP API: Improve compliance with IPv4 Special-Purpose Address Space.
  • Users: Prevent Usernames from mangling HTML
  • Canonical: Only redirect for publicly viewable post types.
  • Administration: When wp_is_large_user_count(), ensure that the post author is always added to author dropdown.

Merges [63060],[63061],[63062],[63063],[63064],[63065],[63067] to the 4.9 branch.

Props xknown, westonruter, jeremyfelt, peterwilsoncc, paulkevan, lucasbustamante, jorbin, desrosj, vortfu, dmsnell, johnbillion, ehtis, batmoo, lancewillett, jonsurrell.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9/src/wp-includes/user.php

    r47648 r63113  
    170170                                /* translators: %s: user name */
    171171                                __( '<strong>ERROR</strong>: The password you entered for the username %s is incorrect.' ),
    172                                 '<strong>' . $username . '</strong>'
     172                                '<strong>' . esc_html( $username ) . '</strong>'
    173173                        ) .
    174174                        ' <a href="' . wp_lostpassword_url() . '">' .
    … …  
    242242                                /* translators: %s: email address */
    243243                                __( '<strong>ERROR</strong>: The password you entered for the email address %s is incorrect.' ),
    244                                 '<strong>' . $email . '</strong>'
     244                                '<strong>' . esc_html( $email ) . '</strong>'
    245245                        ) .
    246246                        ' <a href="' . wp_lostpassword_url() . '">' .
    … …  
    24092409        $user_id = wp_create_user( $sanitized_user_login, $user_pass, $user_email );
    24102410        if ( ! $user_id || is_wp_error( $user_id ) ) {
    2411                 $errors->add( 'registerfail', sprintf( __( '<strong>ERROR</strong>: Couldn&#8217;t register you&hellip; please contact the <a href="mailto:%s">webmaster</a> !' ), get_option( 'admin_email' ) ) );
     2411                $errors->add( 'registerfail', sprintf( __( '<strong>ERROR</strong>: Couldn&#8217;t register you&hellip; please contact the <a href="mailto:%s">webmaster</a> !' ), esc_attr( get_option( 'admin_email' ) ) ) );
    24122412                return $errors;
    24132413        }
    … …  
    26172617 * @since 3.0.0
    26182618 * @since 4.9.0 This function was moved from wp-admin/includes/ms.php so it's no longer Multisite specific.
     2619 * @since 7.0.3 Added the `$user_id` parameter, which is sent with the `personal_options_update` action.
     2620 *
     2621 * @param int $user_id Optional. The ID of the user whose email is being changed. Defaults to `$_POST['user_id']` if set, otherwise 0.
    26192622 *
    26202623 * @global WP_Error $errors WP_Error object.
    26212624 * @global wpdb     $wpdb   WordPress database object.
    26222625 */
    2623 function send_confirmation_on_profile_email() {
     2626function send_confirmation_on_profile_email( $user_id = 0 ) {
    26242627        global $errors, $wpdb;
     2628
     2629        // Maintain backward compatibility for those relying on a check based on $_POST['user_id'].
     2630        if ( ! $user_id && isset( $_POST['user_id'] ) ) {
     2631                $user_id = (int) $_POST['user_id'];
     2632        }
    26252633
    26262634        $current_user = wp_get_current_user();
    … …  
    26292637        }
    26302638
    2631         if ( $current_user->ID != $_POST['user_id'] ) {
     2639        if ( 0 === $current_user->ID || $current_user->ID !== (int) $user_id ) {
    26322640                return false;
    26332641        }
    … …  
    26392647                        ) );
    26402648
     2649                        $_POST['email'] = addslashes( $current_user->user_email );
    26412650                        return;
    26422651                }
    … …  
    26482657                        delete_user_meta( $current_user->ID, '_new_email' );
    26492658
     2659                        $_POST['email'] = addslashes( $current_user->user_email );
    26502660                        return;
    26512661                }
Note: See TracChangeset for help on using the changeset viewer.