Skip to content

Commit b3ec4b8

Browse files
authored
Merge pull request from GHSA-2jx3-5j9v-prpp
Validate order by and order way
2 parents 13e64b2 + be79516 commit b3ec4b8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Search/WishListProductSearchProvider.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
use Product;
3636
use Shop;
3737
use Symfony\Component\Translation\TranslatorInterface;
38+
use Validate;
3839
use WishList;
3940

4041
/**
@@ -167,7 +168,10 @@ private function getProductsOrCount(
167168

168169
if ('products' === $type) {
169170
$sortOrder = $query->getSortOrder()->toLegacyOrderBy(true);
170-
$querySearch->orderBy($sortOrder . ' ' . $query->getSortOrder()->toLegacyOrderWay());
171+
$sortWay = $query->getSortOrder()->toLegacyOrderWay();
172+
if (Validate::isOrderBy($sortOrder) && Validate::isOrderWay($sortWay)) {
173+
$querySearch->orderBy($sortOrder . ' ' . $sortWay);
174+
}
171175
$querySearch->limit((int) $query->getResultsPerPage(), ((int) $query->getPage() - 1) * (int) $query->getResultsPerPage());
172176
$products = $this->db->executeS($querySearch);
173177

0 commit comments

Comments
 (0)