--- a/wpvivid-backuprestore/admin/partials/wpvivid-remote-storage-page-display.php
+++ b/wpvivid-backuprestore/admin/partials/wpvivid-remote-storage-page-display.php
@@ -270,6 +270,18 @@
}
}
+ function wpvivid_toggle_sensitive_hint($input)
+ {
+ var $hint = $input.next('.wpvivid-sensitive-hint');
+ if($hint.length === 0) return;
+
+ if(($input.val() || '').length > 0){
+ $hint.hide();
+ }else{
+ $hint.show();
+ }
+ }
+
function click_retrieve_remote_storage(id,type,name)
{
wpvivid_editing_storage_id = id;
@@ -291,14 +303,54 @@
var jsonarray = jQuery.parseJSON(data);
if (jsonarray.result === 'success')
{
- /*jQuery('input:text[option=edit-'+jsonarray.type+']').each(function(){
+ var sensitive_keys = ['host','server','password','access','secret'];
+
+ jQuery('input:text[option=edit-'+jsonarray.type+'], textarea[option=edit-'+jsonarray.type+'], select[option=edit-'+jsonarray.type+']').each(function(){
var key = jQuery(this).prop('name');
- jQuery(this).val(jsonarray[key]);
+ if(sensitive_keys.indexOf(key) !== -1 && jsonarray[key]){
+ var $input = jQuery(this);
+ $input.val('');
+ $input.attr('placeholder','********');
+ if ($input.next('.wpvivid-sensitive-hint').length === 0) {
+ $input.after(
+ '<div class="wpvivid-sensitive-hint" style="margin-top:4px;color:#999;font-size:12px;">' +
+ '⚠️ This value is hidden for security reasons. Please re-enter it to save changes.' +
+ '</div>'
+ );
+ }
+ $input.off('input.wpvividSensitive').on('input.wpvividSensitive', function(){
+ wpvivid_toggle_sensitive_hint(jQuery(this));
+ });
+ wpvivid_toggle_sensitive_hint($input);
+ }
+ else{
+ jQuery(this).val(jsonarray[key]);
+ }
});
+
jQuery('input:password[option=edit-'+jsonarray.type+']').each(function(){
var key = jQuery(this).prop('name');
- jQuery(this).val(jsonarray[key]);
- });*/
+ if(sensitive_keys.indexOf(key) !== -1 && jsonarray[key]){
+ var $input = jQuery(this);
+ $input.val('');
+ $input.attr('placeholder','********');
+ if ($input.next('.wpvivid-sensitive-hint').length === 0) {
+ $input.after(
+ '<div class="wpvivid-sensitive-hint" style="margin-top:4px;color:#999;font-size:12px;">' +
+ '⚠️ This value is hidden for security reasons. Please re-enter it to save changes.' +
+ '</div>'
+ );
+ }
+ $input.off('input.wpvividSensitive').on('input.wpvividSensitive', function(){
+ wpvivid_toggle_sensitive_hint(jQuery(this));
+ });
+ wpvivid_toggle_sensitive_hint($input);
+ }
+ else{
+ jQuery(this).val(jsonarray[key]);
+ }
+ });
+
jQuery('input:checkbox[option=edit-'+jsonarray.type+']').each(function() {
var key = jQuery(this).prop('name');
var value;
--- a/wpvivid-backuprestore/includes/class-wpvivid-crypt.php
+++ b/wpvivid-backuprestore/includes/class-wpvivid-crypt.php
@@ -57,6 +57,10 @@
$rsa = new Crypt_RSA();
$rsa->loadKey($this->public_key);
$key=$rsa->decrypt($key);
+ if ($key === false || empty($key))
+ {
+ return false;
+ }
$rij = new Crypt_Rijndael();
$rij->setKey($key);
return $rij->decrypt($data);
--- a/wpvivid-backuprestore/includes/customclass/class-wpvivid-send-to-site.php
+++ b/wpvivid-backuprestore/includes/customclass/class-wpvivid-send-to-site.php
@@ -627,8 +627,18 @@
$wpvivid_plugin->wpvivid_log->WriteLog('start upload.','notice');
$dir=WPvivid_Setting::get_backupdir();
- $file_path=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.str_replace('wpvivid','wpvivid_temp',$params['name']);
-
+ $safe_name = basename($params['name']);
+ $safe_name = preg_replace('/[^a-zA-Z0-9._-]/', '', $safe_name);
+ $allowed_extensions = array('zip', 'gz', 'tar', 'sql');
+ $file_ext = strtolower(pathinfo($safe_name, PATHINFO_EXTENSION));
+ if (!in_array($file_ext, $allowed_extensions, true))
+ {
+ $ret['result'] = WPVIVID_FAILED;
+ $ret['error'] = 'Invalid file type - only backup files allowed.';
+ echo wp_json_encode($ret);
+ die();
+ }
+ $file_path=WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.str_replace('wpvivid', 'wpvivid_temp', $safe_name);
if(!file_exists($file_path))
{
$handle=fopen($file_path,'w');
@@ -663,8 +673,7 @@
if (md5_file($file_path) == $params['md5'])
{
$wpvivid_plugin->wpvivid_log->WriteLog('rename temp file:'.$file_path.' to new name:'.WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.$params['name'],'notice');
- rename($file_path,WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.$params['name']);
-
+ rename($file_path,WP_CONTENT_DIR.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.$safe_name);
$ret['result']=WPVIVID_SUCCESS;
$ret['op']='finished';
} else {
@@ -894,8 +903,18 @@
}
$dir = WPvivid_Setting::get_backupdir();
- $file_path = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR . str_replace('wpvivid', 'wpvivid_temp', $params['name']);
-
+ $safe_name = basename($params['name']);
+ $safe_name = preg_replace('/[^a-zA-Z0-9._-]/', '', $safe_name);
+ $allowed_extensions = array('zip', 'gz', 'tar', 'sql');
+ $file_ext = strtolower(pathinfo($safe_name, PATHINFO_EXTENSION));
+ if (!in_array($file_ext, $allowed_extensions, true))
+ {
+ $ret['result'] = WPVIVID_FAILED;
+ $ret['error'] = 'Invalid file type - only backup files allowed.';
+ echo wp_json_encode($ret);
+ die();
+ }
+ $file_path = WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR . str_replace('wpvivid', 'wpvivid_temp', $safe_name);
$rename = true;
if (!file_exists($file_path))
@@ -919,7 +938,7 @@
if (filesize($file_path) >= $params['file_size']) {
if (md5_file($file_path) == $params['md5']) {
if ($rename)
- rename($file_path, WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR . $params['name']);
+ rename($file_path, WP_CONTENT_DIR . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR . $safe_name);
$ret['result'] = WPVIVID_SUCCESS;
$ret['file_status']['status'] = 'finished';
} else {
--- a/wpvivid-backuprestore/wpvivid-backuprestore.php
+++ b/wpvivid-backuprestore/wpvivid-backuprestore.php
@@ -7,7 +7,7 @@
* @wordpress-plugin
* Plugin Name: WPvivid Backup Plugin
* Description: Clone or copy WP sites then move or migrate them to new host (new domain), schedule backups, transfer backups to leading remote storage. All in one.
- * Version: 0.9.123
+ * Version: 0.9.124
* Author: WPvivid Backup & Migration
* Author URI: https://wpvivid.com
* License: GPL-3.0+
@@ -21,7 +21,7 @@
die;
}
-define( 'WPVIVID_PLUGIN_VERSION', '0.9.123' );
+define( 'WPVIVID_PLUGIN_VERSION', '0.9.124' );
//
define('WPVIVID_RESTORE_INIT','init');
define('WPVIVID_RESTORE_READY','ready');