monitoring/list/services: Protect custom variables added with ?addColumns

This commit is contained in:
Johannes Meyer 2021-02-02 16:06:32 +01:00
parent c953e4f92d
commit e035f5b9f2

View File

@ -120,7 +120,11 @@ if (! $this->compact): ?>
</div> </div>
</td> </td>
<?php foreach($this->addColumns as $col): ?> <?php foreach($this->addColumns as $col): ?>
<?php if ($service->$col && preg_match('~^_(host|service)_([a-zA-Z0-9_]+)$~', $col, $m)): ?>
<td><?= $this->escape(\Icinga\Module\Monitoring\Object\MonitoredObject::protectCustomVars([$m[2] => $service->$col])[$m[2]]) ?></td>
<?php else: ?>
<td><?= $this->escape($service->$col) ?></td> <td><?= $this->escape($service->$col) ?></td>
<?php endif ?>
<?php endforeach ?> <?php endforeach ?>
</tr> </tr>
<?php endforeach ?> <?php endforeach ?>