Skip to content
Snippets Groups Projects
Commit 0795f7d7 authored by Robin Appelman's avatar Robin Appelman
Browse files

hide passwords and secrets on default

parent 909b31ea
No related branches found
No related tags found
No related merge requests found
......@@ -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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment