diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-11-23 12:24:24 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2015-11-23 12:24:24 +0100 |
commit | 0795f7d71bdc5e7c1a444fd06cf76525e951850b (patch) | |
tree | 3b905cf9dc462f7ca80e95289411438f9c3abfe7 | |
parent | 909b31ea58eb1a8edf80830f2d0e7d97c72a6307 (diff) | |
download | nextcloud-server-0795f7d71bdc5e7c1a444fd06cf76525e951850b.tar.gz nextcloud-server-0795f7d71bdc5e7c1a444fd06cf76525e951850b.zip |
hide passwords and secrets on default
-rw-r--r-- | apps/files_external/command/listcommand.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/apps/files_external/command/listcommand.php b/apps/files_external/command/listcommand.php index 1c0a2d476fb..c10ca1efeb7 100644 --- a/apps/files_external/command/listcommand.php +++ b/apps/files_external/command/listcommand.php @@ -72,6 +72,11 @@ class ListCommand extends Base { 'user_id', InputArgument::OPTIONAL, 'user id to list the personal mounts for, if no user is provided admin mounts will be listed' + )->addOption( + 'show-password', + null, + InputOption::VALUE_NONE, + 'show passwords and secrets' ); parent::configure(); } @@ -90,6 +95,7 @@ class ListCommand extends Base { $storageService = $this->globalService; } + /** @var $mounts StorageConfig[] */ $mounts = $storageService->getAllStorages(); if (count($mounts) === 0) { @@ -108,6 +114,18 @@ class ListCommand extends Base { $headers[] = 'Applicable Groups'; } + if (!$input->getOption('show-password')) { + $hideKeys = ['password', 'refresh_token', 'token', 'client_secret', 'public_key', 'private_key']; + foreach ($mounts as $mount) { + $config = $mount->getBackendOptions(); + foreach ($config as $key => $value) { + if (in_array($key, $hideKeys)) { + $mount->setBackendOption($key, '***'); + } + } + } + } + $outputType = $input->getOption('output'); if ($outputType === self::OUTPUT_FORMAT_JSON || $outputType === self::OUTPUT_FORMAT_JSON_PRETTY) { $keys = array_map(function ($header) { |