diff options
author | Joas Schilling <nickvergessen@owncloud.com> | 2015-08-19 14:06:05 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@owncloud.com> | 2015-08-19 14:06:05 +0200 |
commit | 6231bbdde39301b62092eb6e2286a00d62ce07ea (patch) | |
tree | da120ceaf48760218184c183f36e37a6f60bdf89 /core | |
parent | 0b37004808c22792dab350eebfc763db6408b440 (diff) | |
download | nextcloud-server-6231bbdde39301b62092eb6e2286a00d62ce07ea.tar.gz nextcloud-server-6231bbdde39301b62092eb6e2286a00d62ce07ea.zip |
Filter the objectstore password from the config list as well
Diffstat (limited to 'core')
-rw-r--r-- | core/command/config/listconfigs.php | 45 |
1 files changed, 35 insertions, 10 deletions
diff --git a/core/command/config/listconfigs.php b/core/command/config/listconfigs.php index 34a0b7169fd..5796362f2fc 100644 --- a/core/command/config/listconfigs.php +++ b/core/command/config/listconfigs.php @@ -34,15 +34,18 @@ class ListConfigs extends Base { /** @var array */ protected $sensitiveValues = [ - 'dbpassword', - 'dbuser', - 'mail_smtpname', - 'mail_smtppassword', - 'passwordsalt', - 'secret', - 'ldap_agent_password', + 'dbpassword' => true, + 'dbuser' => true, + 'mail_smtpname' => true, + 'mail_smtppassword' => true, + 'passwordsalt' => true, + 'secret' => true, + 'ldap_agent_password' => true, + 'objectstore' => ['arguments' => ['password' => true]], ]; + const SENSITIVE_VALUE = '***REMOVED SENSITIVE VALUE***'; + /** * @var SystemConfig */ protected $systemConfig; @@ -124,11 +127,12 @@ class ListConfigs extends Base { $configs = []; foreach ($keys as $key) { - if ($noSensitiveValues && in_array($key, $this->sensitiveValues)) { - continue; + $value = $this->systemConfig->getValue($key, serialize(null)); + + if ($noSensitiveValues && isset($this->sensitiveValues[$key])) { + $value = $this->removeSensitiveValue($this->sensitiveValues[$key], $value); } - $value = $this->systemConfig->getValue($key, serialize(null)); if ($value !== 'N;') { $configs[$key] = $value; } @@ -136,4 +140,25 @@ class ListConfigs extends Base { return $configs; } + + /** + * @param bool|array $keysToRemove + * @param mixed $value + * @return mixed + */ + protected function removeSensitiveValue($keysToRemove, $value) { + if ($keysToRemove === true) { + return self::SENSITIVE_VALUE; + } + + if (is_array($value)) { + foreach ($keysToRemove as $keyToRemove => $valueToRemove) { + if (isset($value[$keyToRemove])) { + $value[$keyToRemove] = $this->removeSensitiveValue($valueToRemove, $value[$keyToRemove]); + } + } + } + + return $value; + } } |