From da5704fa8375f69d06cbe9da85be9e56072b9bb3 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Tue, 10 Dec 2019 07:56:11 +0100 Subject: [PATCH] Revert "Introduce option to hide specific customvars in web" --- .../forms/Config/SecurityConfigForm.php | 15 --------------- .../Monitoring/Object/MonitoredObject.php | 19 ------------------- 2 files changed, 34 deletions(-) diff --git a/modules/monitoring/application/forms/Config/SecurityConfigForm.php b/modules/monitoring/application/forms/Config/SecurityConfigForm.php index 8824931c9..d57f985ce 100644 --- a/modules/monitoring/application/forms/Config/SecurityConfigForm.php +++ b/modules/monitoring/application/forms/Config/SecurityConfigForm.php @@ -61,21 +61,6 @@ class SecurityConfigForm extends ConfigForm ) ) ); - - $this->addElement( - 'text', - 'hidden_customvars', - array( - 'allowEmpty' => true, - 'attribs' => array('placeholder' => $this->getDefaultProtectedCustomvars()), - 'label' => $this->translate('Hidden Custom Variables'), - 'description' => $this->translate( - 'Comma separated case insensitive list of hidden custom variables.' - . ' Use * as a placeholder for zero or more wildcard characters.' - . ' Existence of those custom variables will not be shown, but remain usable for modules.' - ) - ) - ); } /** diff --git a/modules/monitoring/library/Monitoring/Object/MonitoredObject.php b/modules/monitoring/library/Monitoring/Object/MonitoredObject.php index 541df905a..65e8fbada 100644 --- a/modules/monitoring/library/Monitoring/Object/MonitoredObject.php +++ b/modules/monitoring/library/Monitoring/Object/MonitoredObject.php @@ -419,9 +419,7 @@ abstract class MonitoredObject implements Filterable public function fetchCustomvars() { $blacklist = array(); - $hidden = array(); $blacklistPattern = ''; - $hiddenPattern = ''; if (($blacklistConfig = Config::module('monitoring')->get('security', 'protected_customvars', '')) !== '') { foreach (explode(',', $blacklistConfig) as $customvar) { @@ -434,17 +432,6 @@ abstract class MonitoredObject implements Filterable $blacklistPattern = '/^(' . implode('|', $blacklist) . ')$/i'; } - if (($hiddenConfig = Config::module('monitoring')->get('security', 'hidden_customvars', '')) !== '') { - foreach (explode(',', $hiddenConfig) as $customvar) { - $nonWildcards = array(); - foreach (explode('*', $customvar) as $nonWildcard) { - $nonWildcards[] = preg_quote($nonWildcard, '/'); - } - $hidden[] = implode('.*', $nonWildcards); - } - $hiddenPattern = '/^(' . implode('|', $hidden) . ')$/i'; - } - if ($this->type === self::TYPE_SERVICE) { $this->fetchServiceVariables(); $customvars = $this->serviceVariables; @@ -460,12 +447,6 @@ abstract class MonitoredObject implements Filterable $this->customvars = $this->obfuscateCustomVars($this->customvars, $blacklistPattern); } - if ($hiddenPattern) { - $this->customvars = array_filter($this->customvars, function ($elem) use ($hiddenPattern) { - return !($hiddenPattern && preg_match($hiddenPattern, $elem)); - }, ARRAY_FILTER_USE_KEY); - } - return $this; }