fixed Vulnerability issue while uploading images in hotel reviews

This commit is contained in:
azhar bhat
2026-01-14 20:03:58 +05:30
parent a6b27ba299
commit b2a5b523b6

View File

@@ -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,