Privacy: Remove user's email address from personal data export filename.

Use `wp_unique_filename()` to avoid potential collisions instead.

Props xkon, garrett-eclipse, donmhico, Ov3rfly, Clorith, allendav.
Fixes #44197.
Built from https://develop.svn.wordpress.org/trunk@47144


git-svn-id: http://core.svn.wordpress.org/trunk@46944 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-01-31 00:58:06 +00:00
parent 4f67024da6
commit eafc40be6d
2 changed files with 3 additions and 5 deletions

View File

@ -320,11 +320,9 @@ function wp_privacy_generate_personal_data_export_file( $request_id ) {
fclose( $file ); fclose( $file );
} }
$stripped_email = str_replace( '@', '-at-', $email_address );
$stripped_email = sanitize_title( $stripped_email ); // Slugify the email address.
$obscura = wp_generate_password( 32, false, false ); $obscura = wp_generate_password( 32, false, false );
$file_basename = 'wp-personal-data-file-' . $stripped_email . '-' . $obscura; $file_basename = 'wp-personal-data-file-' . $obscura;
$html_report_filename = $file_basename . '.html'; $html_report_filename = wp_unique_filename( $exports_dir, $file_basename . '.html' );
$html_report_pathname = wp_normalize_path( $exports_dir . $html_report_filename ); $html_report_pathname = wp_normalize_path( $exports_dir . $html_report_filename );
$file = fopen( $html_report_pathname, 'w' ); $file = fopen( $html_report_pathname, 'w' );
if ( false === $file ) { if ( false === $file ) {

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.4-alpha-47143'; $wp_version = '5.4-alpha-47144';
/** /**
* 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.