From f6fae87e73bf32391bb5b74dc1b46be97ee5b1b9 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Thu, 18 Apr 2024 03:17:13 +0000 Subject: [PATCH] Upgrade/Install: Validate source & destination values in `WP_Ugrader`. Adds a missing string and some additional validation of paths in the upgrader class. Follow up to [56992]. Props costdev, jipmoors, karlijnbok, swissspidy, afragen, mukesh27. Fixes #59712. Built from https://develop.svn.wordpress.org/trunk@58022 git-svn-id: http://core.svn.wordpress.org/trunk@57488 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-upgrader.php | 6 +++++- wp-includes/version.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/wp-admin/includes/class-wp-upgrader.php b/wp-admin/includes/class-wp-upgrader.php index 1fbfa99e4c..c54384e742 100644 --- a/wp-admin/includes/class-wp-upgrader.php +++ b/wp-admin/includes/class-wp-upgrader.php @@ -196,6 +196,7 @@ class WP_Upgrader { /* translators: %s: Directory name. */ $this->strings['fs_no_folder'] = __( 'Unable to locate needed folder (%s).' ); + $this->strings['no_package'] = __( 'Package not available.' ); $this->strings['download_failed'] = __( 'Download failed.' ); $this->strings['installing_package'] = __( 'Installing the latest version…' ); $this->strings['no_files'] = __( 'The package contains no files.' ); @@ -527,7 +528,10 @@ class WP_Upgrader { set_time_limit( 300 ); } - if ( empty( $source ) || empty( $destination ) ) { + if ( + ( ! is_string( $source ) || '' === $source || trim( $source ) !== $source ) || + ( ! is_string( $destination ) || '' === $destination || trim( $destination ) !== $destination ) + ) { return new WP_Error( 'bad_request', $this->strings['bad_request'] ); } $this->skin->feedback( 'installing_package' ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 5a64e4d883..f034d44edd 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.6-alpha-58021'; +$wp_version = '6.6-alpha-58022'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.