diff --git a/core/Command/Config/App/SetConfig.php b/core/Command/Config/App/SetConfig.php index ae6f24e71d49e..3adba4af69704 100644 --- a/core/Command/Config/App/SetConfig.php +++ b/core/Command/Config/App/SetConfig.php @@ -173,8 +173,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int */ $sensitive = $input->getOption('sensitive'); try { - $currSensitive = $this->appConfig->isLazy($appName, $configName); - if ($sensitive === null || $sensitive === $currSensitive || !$this->ask($input, $output, ($sensitive) ? 'LAZY' : 'NOT LAZY')) { + $currSensitive = $this->appConfig->isSensitive($appName, $configName, null); + if ($sensitive === null || $sensitive === $currSensitive || !$this->ask($input, $output, ($sensitive) ? 'SENSITIVE' : 'NOT SENSITIVE')) { $sensitive = $currSensitive; } } catch (AppConfigUnknownKeyException) { diff --git a/lib/private/AppConfig.php b/lib/private/AppConfig.php index 5d753a6ee9ca9..ccd07b1c20a0a 100644 --- a/lib/private/AppConfig.php +++ b/lib/private/AppConfig.php @@ -1032,14 +1032,20 @@ public function getDetails(string $app, string $key): array { throw new AppConfigUnknownKeyException('unknown config key'); } + $value = $cache[$app][$key]; + $sensitive = $this->isSensitive($app, $key, null); + if ($sensitive && str_starts_with($value, self::ENCRYPTION_PREFIX)) { + $value = $this->crypto->decrypt(substr($value, self::ENCRYPTION_PREFIX_LENGTH)); + } + return [ 'app' => $app, 'key' => $key, - 'value' => $cache[$app][$key], + 'value' => $value, 'type' => $type, 'lazy' => $lazy, 'typeString' => $typeString, - 'sensitive' => $this->isSensitive($app, $key, null) + 'sensitive' => $sensitive ]; } diff --git a/tests/lib/AppConfigTest.php b/tests/lib/AppConfigTest.php index 86bd339bc7ef9..3efeed5755dc6 100644 --- a/tests/lib/AppConfigTest.php +++ b/tests/lib/AppConfigTest.php @@ -1238,7 +1238,7 @@ public function testGetDetailsSensitive(): void { [ 'app' => 'sensitive-app', 'key' => 'lazy-key', - 'value' => $this->baseStruct['sensitive-app']['lazy-key']['encrypted'], + 'value' => 'value', 'type' => 4, 'lazy' => true, 'typeString' => 'string',