From 9b9243fb92de53261ed7f6df639e65d5bc0c9b86 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Wed, 17 Dec 2014 10:45:20 -0200 Subject: [PATCH] Validated webhook delivery_url and topic --- .../meta-boxes/class-wc-meta-box-webhook-data.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/includes/admin/meta-boxes/class-wc-meta-box-webhook-data.php b/includes/admin/meta-boxes/class-wc-meta-box-webhook-data.php index 4c5eb418002..1de4623267e 100644 --- a/includes/admin/meta-boxes/class-wc-meta-box-webhook-data.php +++ b/includes/admin/meta-boxes/class-wc-meta-box-webhook-data.php @@ -185,7 +185,9 @@ class WC_Meta_Box_Webhook_Data { private static function update_delivery_url( $webhook ) { $delivery_url = ! empty( $_POST['delivery_url'] ) ? $_POST['delivery_url'] : ''; - $webhook->set_delivery_url( $delivery_url ); + if ( wc_is_valid_url( $delivery_url ) ) { + $webhook->set_delivery_url( $delivery_url ); + } } /** @@ -214,7 +216,11 @@ class WC_Meta_Box_Webhook_Data { list( $resource, $event ) = explode( '.', wc_clean( $_POST['custom_topic'] ) ); } - $webhook->set_topic( $resource . '.' . $event ); + $topic = $resource . '.' . $event; + + if ( wc_is_webhook_valid_topic( $topic ) ) { + $webhook->set_topic( $topic ); + } } }