diff --git a/core/Command/Config/App/SetConfig.php b/core/Command/Config/App/SetConfig.php index ae6f24e71d4..3adba4af697 100644 --- a/core/Command/Config/App/SetConfig.php +++ b/core/Command/Config/App/SetConfig.php @@ -173,8 +173,8 @@ class SetConfig extends Base { */ $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 c72a4073832..338792e23d1 100644 --- a/lib/private/AppConfig.php +++ b/lib/private/AppConfig.php @@ -1034,14 +1034,20 @@ class AppConfig implements IAppConfig { 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 5bbc3f56791..d25a25c8e66 100644 --- a/tests/lib/AppConfigTest.php +++ b/tests/lib/AppConfigTest.php @@ -1253,7 +1253,7 @@ class AppConfigTest extends TestCase { [ 'app' => 'sensitive-app', 'key' => 'lazy-key', - 'value' => $this->baseStruct['sensitive-app']['lazy-key']['encrypted'], + 'value' => 'value', 'type' => 4, 'lazy' => true, 'typeString' => 'string',