aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2024-04-17 16:27:21 -0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-04-18 08:06:27 +0000
commitdb3e5fb2376b1eb4ed672ebd76eadf16ad1ff665 (patch)
treec2a1a742d36aa27c54ec6ae072be0cfb815ce1b7
parent3d480526e6e9450d42c3e9ec7ecd127359d0f63e (diff)
downloadnextcloud-server-db3e5fb2376b1eb4ed672ebd76eadf16ad1ff665.tar.gz
nextcloud-server-db3e5fb2376b1eb4ed672ebd76eadf16ad1ff665.zip
fix(appconfig): returns correct value on details
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
-rw-r--r--core/Command/Config/App/SetConfig.php4
-rw-r--r--lib/private/AppConfig.php10
-rw-r--r--tests/lib/AppConfigTest.php2
3 files changed, 11 insertions, 5 deletions
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 5d753a6ee9c..ccd07b1c20a 100644
--- a/lib/private/AppConfig.php
+++ b/lib/private/AppConfig.php
@@ -1032,14 +1032,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 86bd339bc7e..3efeed5755d 100644
--- a/tests/lib/AppConfigTest.php
+++ b/tests/lib/AppConfigTest.php
@@ -1238,7 +1238,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',