Skip to content

Commit 3f36ae8

Browse files
cedric-annebtry
authored andcommitted
Fix IDOR tokens generation
1 parent dbfcc79 commit 3f36ae8

1 file changed

Lines changed: 24 additions & 4 deletions

File tree

inc/form_validator.class.php

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,12 @@ public function showForForm(PluginFormcreatorForm $item, $options = []) {
192192
'valuesnames' => array_values($selectedValidatorUsers),
193193
'condition' => Dropdown::addNewCondition($usersCondition),
194194
];
195-
$params['_idor_token'] = Session::getNewIDORToken(User::getType());
195+
$params['_idor_token'] = Session::getNewIDORToken(
196+
User::getType(),
197+
[
198+
'condition' => $params['condition'],
199+
]
200+
);
196201
echo Html::jsAjaxDropdown(
197202
'_validator_users[]',
198203
'_validator_users' . mt_rand(),
@@ -274,7 +279,12 @@ public function showForForm(PluginFormcreatorForm $item, $options = []) {
274279
'condition' => Dropdown::addNewCondition($groupsCondition),
275280
'display_emptychoice' => false,
276281
];
277-
$params['_idor_token'] = Session::getNewIDORToken(Group::getType());
282+
$params['_idor_token'] = Session::getNewIDORToken(
283+
Group::getType(),
284+
[
285+
'condition' => $params['condition'],
286+
]
287+
);
278288
echo Html::jsAjaxDropdown(
279289
'_validator_groups[]',
280290
'_validator_groups' . mt_rand(),
@@ -567,8 +577,13 @@ public static function dropdownValidatorUser(): string {
567577
'entity_restrict' => -1,
568578
'itemtype' => User::getType(),
569579
'condition' => Dropdown::addNewCondition($usersCondition),
570-
'_idor_token' => Session::getNewIDORToken(User::getType()),
571580
];
581+
$params['_idor_token'] = Session::getNewIDORToken(
582+
User::getType(),
583+
[
584+
'condition' => $params['condition'],
585+
]
586+
);
572587

573588
return Html::jsAjaxDropdown(
574589
'_validator_users[]',
@@ -646,8 +661,13 @@ public static function dropdownValidatorGroup(): string {
646661
'itemtype' => Group::getType(),
647662
'condition' => Dropdown::addNewCondition($groupsCondition),
648663
'display_emptychoice' => false,
649-
'_idor_token' => Session::getNewIDORToken(Group::getType()),
650664
];
665+
$params['_idor_token'] = Session::getNewIDORToken(
666+
Group::getType(),
667+
[
668+
'condition' => $params['condition'],
669+
]
670+
);
651671

652672
return Html::jsAjaxDropdown(
653673
'_validator_groups[]',

0 commit comments

Comments
 (0)