Validate check array in the backend

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2019-12-23 11:57:41 +01:00
parent dca861de94
commit e7ad044826
No known key found for this signature in database
GPG Key ID: 4C614C6ED2CDE6DF
1 changed files with 7 additions and 0 deletions

View File

@ -467,9 +467,16 @@ class Manager implements IManager {
$this->validateEvents($entity, $events, $instance);
if (count($checks) === 0) {
throw new \UnexpectedValueException($this->l->t('At least one check needs to be provided'));
}
$instance->validateOperation($name, $checks, $operation);
foreach ($checks as $check) {
if (!is_string($check['class'])) {
throw new \UnexpectedValueException($this->l->t('Invalid check provided'));
}
try {
/** @var ICheck $instance */
$instance = $this->container->query($check['class']);