Skip to content

Commit

Permalink
Add missing inputs for rules using ticket validation criteria
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainLvr committed Dec 19, 2024
1 parent ec80b07 commit d96ffdf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/CommonITILValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ public function post_updateItem($history = true)
'id' => $this->fields[static::$items_id],
'global_validation' => self::computeValidationStatus($item),
'_from_itilvalidation' => true,
'itemtype' => static::$itemtype
];
$item->update($input);
}
Expand Down
8 changes: 7 additions & 1 deletion src/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -1716,7 +1716,13 @@ public function checkCriteria($criteria, &$input)
$partial_regex_result = [];
// Undefine criteria field : set to blank
if (!isset($input[$criteria->fields["criteria"]])) {
$input[$criteria->fields["criteria"]] = '';
if (isset($input['itemtype'])) {
$itemtype = new $input['itemtype']();

Check warning

Code scanning / SonarCloud

Reflection should not be vulnerable to injection attacks Medium

Change this code to not construct class or method names directly from user-controlled data. See more on SonarQube Cloud
$item = $itemtype->getById($input['id']);
$input[$criteria->fields["criteria"]] = $item->fields[$criteria->fields["criteria"]];
} else {
$input[$criteria->fields["criteria"]] = '';
}
}

//If the value is not an array
Expand Down

0 comments on commit d96ffdf

Please sign in to comment.