Skip to content

Commit

Permalink
VolatileStateResults: Don't reapply commandline values if not permitted
Browse files Browse the repository at this point in the history
  • Loading branch information
nilmerg committed Jun 22, 2023
1 parent 0f7452f commit 2093690
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions library/Icingadb/Redis/VolatileStateResults.php
Expand Up @@ -7,6 +7,7 @@
use Exception;
use Generator;
use Icinga\Application\Benchmark;
use Icinga\Module\Icingadb\Common\Auth;
use Icinga\Module\Icingadb\Common\IcingaRedis;
use Icinga\Module\Icingadb\Model\Host;
use Icinga\Module\Icingadb\Model\Service;
Expand All @@ -18,6 +19,8 @@

class VolatileStateResults extends ResultSet
{
use Auth;

/** @var Resolver */
private $resolver;

Expand Down Expand Up @@ -91,6 +94,8 @@ protected function applyRedisUpdates()
$keys = [];
$hostStateKeys = [];

$showSourceGranted = $this->getAuth()->hasPermission('icingadb/object/show-source');

$states = [];
$hostStates = [];
foreach ($this as $row) {
Expand All @@ -112,6 +117,9 @@ protected function applyRedisUpdates()
$states[bin2hex($row->id)] = $row->state;
if (empty($keys)) {
$keys = $row->state->getColumns();
if (! $showSourceGranted) {
$keys = array_diff($keys, ['check_commandline']);
}
}

if ($type === 'service' && $row->host instanceof Host) {
Expand Down

0 comments on commit 2093690

Please sign in to comment.