Merge pull request #3440 from Icinga/feature/secure-detailviewextensionhook-gethtmlforobject-3393

Secure DetailviewExtensionHook::getHtmlForObject()
This commit is contained in:
Eric Lippmann 2018-05-07 04:19:32 -04:00 committed by GitHub
commit e74b1fc5eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -3,6 +3,7 @@
namespace Icinga\Module\Monitoring\Web\Controller;
use Exception;
use Icinga\Module\Monitoring\Controller;
use Icinga\Module\Monitoring\Forms\Command\Object\CheckNowCommandForm;
use Icinga\Module\Monitoring\Forms\Command\Object\DeleteCommentCommandForm;
@ -84,9 +85,16 @@ abstract class MonitoredObjectController extends Controller
$this->view->extensionsHtml = array();
foreach (Hook::all('Monitoring\DetailviewExtension') as $hook) {
/** @var DetailviewExtensionHook $hook */
try {
$html = $hook->setView($this->view)->getHtmlForObject($this->object);
} catch (Exception $e) {
$html = $this->view->escape($e->getMessage());
}
$this->view->extensionsHtml[] =
'<div class="icinga-module module-' . $this->view->escape($hook->getModule()->getName()) . '">'
. $hook->setView($this->view)->getHtmlForObject($this->object)
. $html
. '</div>';
}
}