diff --git a/migrations/db/20261001110000_site-command_strip_backup_metadata_credentials.php b/migrations/db/20261001110000_site-command_strip_backup_metadata_credentials.php new file mode 100644 index 00000000..cb46ba9a --- /dev/null +++ b/migrations/db/20261001110000_site-command_strip_backup_metadata_credentials.php @@ -0,0 +1,58 @@ +dash_backup_id = $auth_parts[0]; $this->dash_verify_token = $auth_parts[1]; $this->dash_api_url = $ed_api_url; + // The token also goes into the logged callback payloads. + if ( method_exists( 'EE', 'obfuscate' ) ) { + EE::obfuscate( [ $dash_auth, $this->dash_verify_token ] ); + } // Debug: Log parsed values EE::debug( 'Parsed backup_id: ' . $this->dash_backup_id ); - EE::debug( 'Parsed verify_token: ' . $this->dash_verify_token ); EE::debug( 'API URL: ' . $this->dash_api_url ); // Register shutdown handler to send failure callback if backup doesn't complete @@ -434,6 +436,10 @@ function ( $theme ) { $remote_path = $this->get_remote_path(); $backup_data['remote_path'] = explode( ':', $remote_path )[1]; $backup_data = array_merge( $this->site_data, $backup_data ); + // Credentials stay out of the backup: restore uses the current site's, and the metadata is also kept unencrypted on the remote and in EE_BACKUP_DIR. + foreach ( self::METADATA_SECRET_KEYS as $key ) { + unset( $backup_data[ $key ] ); + } $backup_data_file = $backup_dir . '/metadata.json'; $metadata_copy = EE_BACKUP_DIR . '/' . $this->site_data['site_url'] . '.metadata.json'; @@ -1704,7 +1710,6 @@ private function send_dash_success_callback( $ed_api_url, $backup_id, $verify_to // Debug: Log the values being used for callback EE::debug( 'Sending success callback with backup_id: ' . $backup_id ); - EE::debug( 'Sending success callback with verify_token: ' . $verify_token ); // Build metadata for the API call - always include all fields $metadata = [ @@ -1727,7 +1732,7 @@ private function send_dash_success_callback( $ed_api_url, $backup_id, $verify_to 'metadata' => $metadata, ]; - EE::debug( 'Payload being sent: ' . json_encode( $payload ) ); + EE::debug( 'Payload being sent: ' . json_encode( array_merge( $payload, [ 'verify' => '******' ] ) ) ); return $this->send_dash_request( $endpoint, $payload ); }