Skip to content

Commit 094d69d

Browse files
committed
Fixed inventory sorting XSS
1 parent 9f0638a commit 094d69d

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/controllers/InventoryController.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,25 @@ public function actionInventoryLevelsTableData(): Response
254254
$field = $sort[0]['sortField'];
255255
$direction = $sort[0]['direction'];
256256

257+
// Validate the sorting inputs
258+
if (!in_array($direction, ['asc', 'desc']) ||
259+
!in_array($field, [
260+
'item',
261+
'sku',
262+
'reservedTotal',
263+
'damagedTotal',
264+
'safetyTotal',
265+
'qualityControlTotal',
266+
'committedTotal',
267+
'availableTotal',
268+
'onHandTotal',
269+
'incomingTotal',
270+
])) {
271+
272+
$field = null;
273+
$direction = null;
274+
}
275+
257276
if ($field && $direction) {
258277
if ($field == 'sku') {
259278
$field = 'purchasables.sku';

0 commit comments

Comments
 (0)