Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/shapepress-dsgvo/includes/class-sp-dsgvo-ajax-action.php
+++ b/shapepress-dsgvo/includes/class-sp-dsgvo-ajax-action.php
@@ -149,7 +149,7 @@
$params = http_build_query(array_merge(array(
'action' => (new static())->action), $params),'', '&');
- error_log($params);
+ //error_log($params);
return admin_url('/admin-ajax.php') .'?'. $params;
}
--- a/shapepress-dsgvo/public/shortcodes/super-unsubscribe/unsubscribe-confirm-action.php
+++ b/shapepress-dsgvo/public/shortcodes/super-unsubscribe/unsubscribe-confirm-action.php
@@ -1,10 +1,22 @@
<?php
-Class SPDSGVOSuperUnsubscribeConfirmAction extends SPDSGVOAjaxAction{
-
- protected $action = 'super-unsubscribe-confirm';
-
- public function run(){
+Class SPDSGVOSuperUnsubscribeConfirmAction extends SPDSGVOAjaxAction{
+
+ protected $action = 'super-unsubscribe-confirm';
+
+ protected function notifyAdmin($email){
+ if (SPDSGVOSettings::get('su_email_notification') !== '1' || SPDSGVOSettings::get('admin_email') === '') {
+ return;
+ }
+
+ wp_mail(
+ SPDSGVOSettings::get('admin_email'),
+ __('New delete request','shapepress-dsgvo').': '. parse_url(home_url(), PHP_URL_HOST),
+ __('A new delete request from ','shapepress-dsgvo') .' '. $email ."' was confirmed."
+ );
+ }
+
+ public function run(){
if(!$this->has('token')){
$this->error(__('No token provided.','shapepress-dsgvo'));
@@ -14,26 +26,30 @@
'token' => $this->get('token')
));
- if(is_null($unsubscriber)){
- $this->error(__('Bad token provided','shapepress-dsgvo'));
- }
-
- if(SPDSGVOSettings::get('unsubscribe_auto_delete') == '1'){
- $unsubscriber->doSuperUnsubscribe();
- }else{
- $unsubscriber->status = 'confirmed';
- $unsubscriber->save();
- }
-
- $superUnsubscribePage = SPDSGVOSettings::get('super_unsubscribe_page');
- if($superUnsubscribePage !== '0'){
- $url = get_permalink($superUnsubscribePage);
- $this->returnRedirect($url, array(
- 'result' => 'confirmed',
- ));
- }
-
- }
-}
+ if(is_null($unsubscriber)){
+ $this->error(__('Bad token provided','shapepress-dsgvo'));
+ }
+
+ if ($unsubscriber->status === 'unconfirmed') {
+ $this->notifyAdmin($unsubscriber->email);
+
+ if(SPDSGVOSettings::get('unsubscribe_auto_delete') == '1'){
+ $unsubscriber->doSuperUnsubscribe();
+ }else{
+ $unsubscriber->status = 'pending';
+ $unsubscriber->save();
+ }
+ }
+
+ $superUnsubscribePage = SPDSGVOSettings::get('super_unsubscribe_page');
+ if($superUnsubscribePage !== '0'){
+ $url = get_permalink($superUnsubscribePage);
+ $this->returnRedirect($url, array(
+ 'result' => $unsubscriber->status === 'done' ? 'confirmed' : 'request_confirmed',
+ ));
+ }
+
+ }
+}
SPDSGVOSuperUnsubscribeConfirmAction::listen();
--- a/shapepress-dsgvo/public/shortcodes/super-unsubscribe/unsubscribe-form-action.php
+++ b/shapepress-dsgvo/public/shortcodes/super-unsubscribe/unsubscribe-form-action.php
@@ -1,48 +1,58 @@
<?php
-Class SPDSGVOSuperUnsubscribeFormAction extends SPDSGVOAjaxAction{
-
- protected $action = 'super-unsubscribe';
-
- public function run(){
+Class SPDSGVOSuperUnsubscribeFormAction extends SPDSGVOAjaxAction{
+
+ protected $action = 'super-unsubscribe';
+
+ protected function notifyAdmin($email){
+ if (SPDSGVOSettings::get('su_email_notification') !== '1' || SPDSGVOSettings::get('admin_email') === '') {
+ return;
+ }
+
+ wp_mail(
+ SPDSGVOSettings::get('admin_email'),
+ __('New delete request','shapepress-dsgvo').': '. parse_url(home_url(), PHP_URL_HOST),
+ __('A new delete request from ','shapepress-dsgvo') .' '. $email ."' was confirmed."
+ );
+ }
+
+ public function run(){
if(!empty($_POST['website'])) die(); // anti spam honeypot
$this->checkCSRF();
- if(!$this->has('email') || empty($this->get('email', NULL, 'sanitize_email'))){
- $this->error(__('Please enter an email address.','shapepress-dsgvo'));
- }
+ $email = $this->get('email', null, 'sanitize_email');
+
+ if (!$email || !is_email($email)) {
+ $this->error(__('Please enter a valid email address.', 'shapepress-dsgvo'));
+ }
if(!$this->has('dsgvo_checkbox') || $this->get('dsgvo_checkbox') !== '1'){
$this->error(__('The GDPR approval is mandatory.','shapepress-dsgvo'));
}
- $unsubscriber = SPDSGVOUnsubscriber::insert(array(
- 'first_name' => $this->get('first_name'),
- 'last_name' => $this->get('last_name'),
- 'email' => $this->get('email', NULL, 'sanitize_email'),
- 'process_now'=> $this->get('process_now'),
- 'dsgvo_accepted' => $this->get('dsgvo_checkbox')
- ));
-
- if (SPDSGVOSettings::get('su_email_notification') === '1'
- && SPDSGVOSettings::get('admin_email') !== ''
- && $this->has('process_now') == false)
- {
- // Send Email
- wp_mail(SPDSGVOSettings::get('admin_email'),
- __('New delete request','shapepress-dsgvo').': '. parse_url(home_url(), PHP_URL_HOST),
- __('A new subject access request from ','shapepress-dsgvo') .' '.$this->get('email')."' was made.");
- }
-
- if($this->has('process_now')){
- $unsubscriber->doSuperUnsubscribe();
- }
-
- if($this->has('is_admin')){
- $this->returnBack();
- }
+ $is_admin_request = $this->has('process_now') && current_user_can('manage_options');
+ $is_privileged_request = $this->has('is_admin') && current_user_can('manage_options');
+ $requires_email_confirmation = !$is_privileged_request;
+
+ $unsubscriber = SPDSGVOUnsubscriber::insert(array(
+ 'first_name' => $this->get('first_name'),
+ 'last_name' => $this->get('last_name'),
+ 'email' => $this->get('email', NULL, 'sanitize_email'),
+ 'process_now'=> $this->get('process_now'),
+ 'dsgvo_accepted' => $this->get('dsgvo_checkbox'),
+ 'status' => $requires_email_confirmation ? 'unconfirmed' : 'pending',
+ ));
+
+ if ($is_privileged_request && $this->has('process_now') == false) {
+ $this->notifyAdmin($email);
+ }
+
+ if ($is_admin_request) {
+ $unsubscriber->doSuperUnsubscribe();
+ $this->returnBack();
+ }
$superUnsubscribePage = SPDSGVOSettings::get('super_unsubscribe_page');
if($superUnsubscribePage !== '0'){
--- a/shapepress-dsgvo/public/shortcodes/super-unsubscribe/unsubscribe-form.php
+++ b/shapepress-dsgvo/public/shortcodes/super-unsubscribe/unsubscribe-form.php
@@ -18,9 +18,13 @@
<p class="sp-dsgvo us-success-message"><?php _e('Request sent successfully. You will receive an email in a few minutes.','shapepress-dsgvo')?></p>
- <?php elseif(isset($_REQUEST['result']) && sanitize_text_field($_REQUEST['result']) === 'confirmed'): ?>
-
- <p class="sp-dsgvo us-success-message"><?php _e('Request successfully completed. Your data has been completely deleted.','shapepress-dsgvo')?></p>
+ <?php elseif(isset($_REQUEST['result']) && sanitize_text_field($_REQUEST['result']) === 'request_confirmed'): ?>
+
+ <p class="sp-dsgvo us-success-message"><?php _e('Request confirmed successfully. Your delete request will be processed shortly.','shapepress-dsgvo')?></p>
+
+ <?php elseif(isset($_REQUEST['result']) && sanitize_text_field($_REQUEST['result']) === 'confirmed'): ?>
+
+ <p class="sp-dsgvo us-success-message"><?php _e('Request successfully completed. Your data has been completely deleted.','shapepress-dsgvo')?></p>
<?php else: ?>
<div class="sp-dsgvo sp-unsubsribe-form">
@@ -84,4 +88,4 @@
return ob_get_clean();
}
-add_shortcode('unsubscribe_form', 'SPDSGVOUnsubscribeShortcode');
No newline at end of file
+add_shortcode('unsubscribe_form', 'SPDSGVOUnsubscribeShortcode');
--- a/shapepress-dsgvo/sp-dsgvo.php
+++ b/shapepress-dsgvo/sp-dsgvo.php
@@ -16,7 +16,7 @@
* Plugin Name: WP DSGVO Tools (GDPR)
* Plugin URI: https://legalweb.io
* Description: WP DSGVO Tools (GDPR) help you to fulfill the GDPR (DGSVO) compliance guidance (<a target="_blank" href="https://ico.org.uk/for-organisations/data-protection-reform/overview-of-the-gdpr/">GDPR</a>)
- * Version: 3.1.38
+ * Version: 3.1.39
* Author: legalweb
* Author URI: https://www.legalweb.io
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
@@ -28,7 +28,7 @@
die();
}
-define('sp_dsgvo_VERSION', '3.1.38');
+define('sp_dsgvo_VERSION', '3.1.39');
define('sp_dsgvo_NAME', 'sp-dsgvo');
define('sp_dsgvo_PLUGIN_NAME', 'shapepress-dsgvo');
define('sp_dsgvo_LEGAL_TEXTS_MIN_VERSION', '1579021814');