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
This commit is contained in:
Peter Wilson 2024-04-18 03:17:13 +00:00
parent cc7370b2af
commit f6fae87e73
2 changed files with 6 additions and 2 deletions

View File

@ -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' );

View File

@ -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.