summaryrefslogtreecommitdiffstats
path: root/core/command
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-08-19 16:24:01 +0200
committerMorris Jobke <hey@morrisjobke.de>2015-08-19 16:24:01 +0200
commit4c93a07196ac2c5051872941bbcc2f175d630379 (patch)
treec30340d7fd05135e4d9cba64cb16a5586b6f35d2 /core/command
parent8f00f103c6a802abd72eac9e769d83db76fd1166 (diff)
parent6231bbdde39301b62092eb6e2286a00d62ce07ea (diff)
downloadnextcloud-server-4c93a07196ac2c5051872941bbcc2f175d630379.tar.gz
nextcloud-server-4c93a07196ac2c5051872941bbcc2f175d630379.zip
Merge pull request #18424 from owncloud/filter-objectstore-password-from-config-list
Filter the objectstore password from the config list as well
Diffstat (limited to 'core/command')
-rw-r--r--core/command/config/listconfigs.php45
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;
+ }
}