WordPress build repository browser

Changeset 62841


Ignore:
Timestamp:
09/17/2026 05:38:46 PM (5 weeks ago)
Author:
desrosj
Message:

Editor: Constrain block template file resolution to the template directory.

Merges r63663 to the 7.1 branch.

Props xknown, ramonopoly, jonsurrell.

Built from ​https://develop.svn.wordpress.org/branches/7.1@63667

Location:
branches/7.1/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/7.1/wp-includes/block-template-utils.php

    r62001 r62841  
    344344        foreach ( $themes as $theme_slug => $theme_dir ) {
    345345                $template_base_paths = get_block_theme_folders( $theme_slug );
    346                 $file_path           = $theme_dir . '/' . $template_base_paths[ $template_type ] . '/' . $slug . '.html';
    347                 if ( file_exists( $file_path ) ) {
     346                $template_dir        = $theme_dir . '/' . $template_base_paths[ $template_type ];
     347                $file_path           = $template_dir . '/' . $slug . '.html';
     348                $template_file       = realpath( $file_path );
     349                $template_root       = realpath( $template_dir );
     350
     351                if (
     352                        false !== $template_file &&
     353                        false !== $template_root &&
     354                        str_starts_with(
     355                                wp_normalize_path( $template_file ),
     356                                trailingslashit( wp_normalize_path( $template_root ) )
     357                        )
     358                ) {
    348359                        $new_template_item = array(
    349360                                'slug'  => $slug,
    350                                 'path'  => $file_path,
     361                                'path'  => $template_file,
    351362                                'theme' => $theme_slug,
    352363                                'type'  => $template_type,
  • branches/7.1/wp-includes/version.php

    r62840 r62841  
    1717 * @global string $wp_version
    1818 */
    19 $wp_version = '7.1.1-RC1-63666';
     19$wp_version = '7.1.1-RC1-63667';
    2020
    2121/**
Note: See TracChangeset for help on using the changeset viewer.