From b2a5b523b6580bcde96c66fee5cfc5915b87ecbe Mon Sep 17 00:00:00 2001 From: azhar bhat Date: Wed, 14 Jan 2026 20:03:58 +0530 Subject: [PATCH] fixed Vulnerability issue while uploading images in hotel reviews --- modules/qlohotelreview/controllers/front/default.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/qlohotelreview/controllers/front/default.php b/modules/qlohotelreview/controllers/front/default.php index 0156e3112..c380cd5f7 100644 --- a/modules/qlohotelreview/controllers/front/default.php +++ b/modules/qlohotelreview/controllers/front/default.php @@ -85,6 +85,16 @@ class QloHotelReviewDefaultModuleFrontController extends ModuleFrontController } } + if (is_array($_FILES) && array_key_exists('images', $_FILES) ) { + $allowedExtensions = array('jpg', 'png'); + foreach ($_FILES['images']['name'] as $key => $imageName) { + $extension = Tools::strtolower(pathinfo($imageName, PATHINFO_EXTENSION)); + if (!in_array($extension, $allowedExtensions)) { + $errors['general'][] = $imageName . ' ' . $objModule->l('is not a supported image format.','default'); + } + } + } + if (!count($errors['by_key']) && !count($errors['general'])) { $customerReview = QhrHotelReview::getByCustomer( $objOrder->id_customer,