From f9de2dc5ec06dbc3e82d74fc1d12ec1c5a627fca Mon Sep 17 00:00:00 2001 From: Razorpay Date: Tue, 12 Nov 2024 12:06:20 +0530 Subject: [PATCH 1/6] PO-241 added esc_url for add and remove arguments --- includes/rzp-payment-buttons.php | 6 +++--- includes/rzp-subscription-buttons.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/includes/rzp-payment-buttons.php b/includes/rzp-payment-buttons.php index 82278f4..5fd0717 100644 --- a/includes/rzp-payment-buttons.php +++ b/includes/rzp-payment-buttons.php @@ -88,16 +88,16 @@ protected function get_views() //All Buttons $class = ($current === 'all' ? ' class="current"' :''); - $all_url = remove_query_arg('status'); + $all_url = esc_url(remove_query_arg('status')); $views['all'] = "All"; //Recovered link - $foo_url = add_query_arg('status','active'); + $foo_url = esc_url(add_query_arg('status','active')); $class = ($current === 'active' ? ' class="current"' :''); $views['status'] = "Enabled"; //Abandon - $bar_url = add_query_arg('status','inactive'); + $bar_url = esc_url(add_query_arg('status','inactive')); $class = ($current === 'inactive' ? ' class="current"' :''); $views['disabled'] = "Disabled"; diff --git a/includes/rzp-subscription-buttons.php b/includes/rzp-subscription-buttons.php index 085f1ee..02cb6c3 100644 --- a/includes/rzp-subscription-buttons.php +++ b/includes/rzp-subscription-buttons.php @@ -88,16 +88,16 @@ protected function get_views() //All Buttons $class = ($current === 'all' ? ' class="current"' :''); - $all_url = remove_query_arg('status'); + $all_url = esc_url(remove_query_arg('status')); $views['all'] = "All"; //Recovered link - $foo_url = add_query_arg('status','active'); + $foo_url = esc_url(add_query_arg('status','active')); $class = ($current === 'active' ? ' class="current"' :''); $views['status'] = "Enabled"; //Abandon - $bar_url = add_query_arg('status','inactive'); + $bar_url = esc_url(add_query_arg('status','inactive')); $class = ($current === 'inactive' ? ' class="current"' :''); $views['disabled'] = "Disabled"; From dbcd446ff9b358120b20030adbe7e4d4bcb90ede Mon Sep 17 00:00:00 2001 From: Razorpay Date: Tue, 12 Nov 2024 13:00:05 +0530 Subject: [PATCH 2/6] added html_esc and sanitize text for output fields --- templates/razorpay-button-view-templates.php | 30 ++++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/templates/razorpay-button-view-templates.php b/templates/razorpay-button-view-templates.php index 9208926..1b09b0e 100644 --- a/templates/razorpay-button-view-templates.php +++ b/templates/razorpay-button-view-templates.php @@ -26,8 +26,8 @@ function razorpay_view_button() { wp_die("This page consist some request parameters to view response"); } - $pagenum = $_REQUEST['paged']; - $type = $_REQUEST['type']; + $pagenum = sanitize_text_field($_REQUEST['paged']); + $type = sanitize_text_field($_REQUEST['type']); if($type === 'payment') { $previous_page_url = admin_url('admin.php?page=razorpay_button&paged='.$pagenum); @@ -46,39 +46,39 @@ function razorpay_view_button() Button List - '.$button_detail['title'].' + ' . esc_html($button_detail['title']) . '
-
'.$button_detail['title'].'
+
' . esc_html($button_detail['title']) . '
Button ID
-
'.$button_detail["id"].'
+
' . esc_html($button_detail["id"]) . '
Button Status
- '.$button_detail['status'].' - + ' . esc_html($button_detail['status']) . ' +
Total Quantity Sold
-
'.$button_detail['total_item_sold'].'
+
' . esc_html($button_detail['total_item_sold']) . '
'; if($type === 'payment') { echo '
Total revenue
-
' . $button_detail['total_revenue'] . '
+
' . esc_html($button_detail['total_revenue']) . '
'; } echo '
Created on
-
'.$button_detail['created_at'].'
+
' . esc_html($button_detail['created_at']) . '
'; if($type === 'subscription') @@ -97,17 +97,17 @@ function razorpay_view_button()
'; // nosemgrep if($type === 'payment') { echo '
From 2e1d1422545e9f751047061837b892fa80e71508 Mon Sep 17 00:00:00 2001 From: Razorpay Date: Tue, 12 Nov 2024 13:44:23 +0530 Subject: [PATCH 6/6] changes esc_html to htmlentities --- templates/razorpay-button-view-templates.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/razorpay-button-view-templates.php b/templates/razorpay-button-view-templates.php index c821a44..3f81aa9 100644 --- a/templates/razorpay-button-view-templates.php +++ b/templates/razorpay-button-view-templates.php @@ -67,8 +67,8 @@ function razorpay_view_button()
Total Quantity Sold
-
' . esc_html($button_detail['total_item_sold']) . '
-
'; // nosemgrep +
' . htmlentities($button_detail['total_item_sold']) . '
+
'; if($type === 'payment') { echo '