Privacy: Use a CSPRNG in export filenames for more security.

`rand()` is deterministic and therefore offers much less protection in this context. `wp_generate_password()` is a convenient wrapper around `wp_rand()`, which uses `random_int()` to generate cryptographically-secure psuedorandom numbers.

See #43546.

Built from https://develop.svn.wordpress.org/trunk@43045


git-svn-id: http://core.svn.wordpress.org/trunk@42874 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
iandunn 2018-04-30 18:53:25 +00:00
parent c21c4e25b3
commit 5b4aa26436
2 changed files with 2 additions and 2 deletions

View File

@ -2042,7 +2042,7 @@ function wp_privacy_generate_personal_data_export_file( $request_id ) {
$stripped_email = str_replace( '@', '-at-', $email_address ); $stripped_email = str_replace( '@', '-at-', $email_address );
$stripped_email = sanitize_title( $stripped_email ); // slugify the email address $stripped_email = sanitize_title( $stripped_email ); // slugify the email address
$obscura = md5( rand() ); $obscura = wp_generate_password( 32, false, false );
$file_basename = 'wp-personal-data-file-' . $stripped_email . '-' . $obscura; $file_basename = 'wp-personal-data-file-' . $stripped_email . '-' . $obscura;
$html_report_filename = $file_basename . '.html'; $html_report_filename = $file_basename . '.html';
$html_report_pathname = $exports_dir . $html_report_filename; $html_report_pathname = $exports_dir . $html_report_filename;

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.0-alpha-43044'; $wp_version = '5.0-alpha-43045';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.