Skip to content

Commit

Permalink
Fix IDOR tokens generation
Browse files Browse the repository at this point in the history
  • Loading branch information
cedric-anne committed Mar 13, 2024
1 parent dbfcc79 commit d3d240c
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions inc/form_validator.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,12 @@ public function showForForm(PluginFormcreatorForm $item, $options = []) {
'valuesnames' => array_values($selectedValidatorUsers),
'condition' => Dropdown::addNewCondition($usersCondition),
];
$params['_idor_token'] = Session::getNewIDORToken(User::getType());
$params['_idor_token'] = Session::getNewIDORToken(
User::getType(),
[
'condition' => $params['condition'],
]
);
echo Html::jsAjaxDropdown(
'_validator_users[]',
'_validator_users' . mt_rand(),
Expand Down Expand Up @@ -274,7 +279,12 @@ public function showForForm(PluginFormcreatorForm $item, $options = []) {
'condition' => Dropdown::addNewCondition($groupsCondition),
'display_emptychoice' => false,
];
$params['_idor_token'] = Session::getNewIDORToken(Group::getType());
$params['_idor_token'] = Session::getNewIDORToken(
Group::getType(),
[
'condition' => $params['condition'],
]
);
echo Html::jsAjaxDropdown(
'_validator_groups[]',
'_validator_groups' . mt_rand(),
Expand Down Expand Up @@ -567,8 +577,13 @@ public static function dropdownValidatorUser(): string {
'entity_restrict' => -1,
'itemtype' => User::getType(),
'condition' => Dropdown::addNewCondition($usersCondition),
'_idor_token' => Session::getNewIDORToken(User::getType()),
];
$params['_idor_token'] = Session::getNewIDORToken(
User::getType(),
[
'condition' => $params['condition'],
]
);

return Html::jsAjaxDropdown(
'_validator_users[]',
Expand Down Expand Up @@ -646,8 +661,13 @@ public static function dropdownValidatorGroup(): string {
'itemtype' => Group::getType(),
'condition' => Dropdown::addNewCondition($groupsCondition),
'display_emptychoice' => false,
'_idor_token' => Session::getNewIDORToken(Group::getType()),
];
$params['_idor_token'] = Session::getNewIDORToken(
Group::getType(),
[
'condition' => $params['condition'],
]
);

return Html::jsAjaxDropdown(
'_validator_groups[]',
Expand Down

0 comments on commit d3d240c

Please sign in to comment.