From 5aa34660acc1333f1021a6d3608e6ee90a5bb9d4 Mon Sep 17 00:00:00 2001 From: Benjamin Gaussorgues Date: Thu, 10 Sep 2026 15:44:35 +0200 Subject: [PATCH 1/2] feat(preferences): deprecate non-lazy user config larger > 128 bytes Signed-off-by: Benjamin Gaussorgues --- lib/private/Config/UserConfig.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/private/Config/UserConfig.php b/lib/private/Config/UserConfig.php index 2869b590f5e0a..e884b96029d94 100644 --- a/lib/private/Config/UserConfig.php +++ b/lib/private/Config/UserConfig.php @@ -55,6 +55,7 @@ class UserConfig implements IUserConfig { private const int APP_MAX_LENGTH = 32; private const int KEY_MAX_LENGTH = 64; private const int INDEX_MAX_LENGTH = 64; + private const int MAX_NON_LAZY_SIZE = 128; // bytes /** @var CappedMemoryCache>> cache for normal config keys */ private CappedMemoryCache $fastCache; @@ -1153,6 +1154,17 @@ private function setTypedValue( return false; } $this->loadConfig($userId, $lazy); + if (!$lazy && strlen($value) > self::MAX_NON_LAZY_SIZE) { + $this->logger->error( + '[Deprecated] User {userId} config "{app}:{key}" is larger than {maxSize} bytes. It should be declared as lazy.', + [ + 'app' => $app, + 'key' => $key, + 'userId' => $userId, + 'maxSize' => self::MAX_NON_LAZY_SIZE, + ] + ); + } $inserted = $refreshCache = false; $origValue = $value; From 8f44021f20bc19abdd387cf008e5cfd03c808497 Mon Sep 17 00:00:00 2001 From: Benjamin Gaussorgues Date: Thu, 10 Sep 2026 16:09:35 +0200 Subject: [PATCH 2/2] feat(appconfig): deprecate non-lazy app config larger > 128 bytes Signed-off-by: Benjamin Gaussorgues --- lib/private/AppConfig.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/private/AppConfig.php b/lib/private/AppConfig.php index 0887a41b2d0a8..d3c7efcf39b70 100644 --- a/lib/private/AppConfig.php +++ b/lib/private/AppConfig.php @@ -58,6 +58,7 @@ class AppConfig implements IAppConfig { private const int ENCRYPTION_PREFIX_LENGTH = 21; // strlen(self::ENCRYPTION_PREFIX) private const string LOCAL_CACHE_KEY = 'OC\\AppConfig'; private const int LOCAL_CACHE_TTL = 3; + private const int MAX_NON_LAZY_SIZE = 128; // bytes /** @var array> ['app_id' => ['config_key' => 'config_value']] */ private array $fastCache = []; // cache for normal config keys @@ -856,6 +857,17 @@ private function setTypedValue( $value = self::ENCRYPTION_PREFIX . $this->crypto->encrypt($value); } + if (!$lazy && strlen($value) > self::MAX_NON_LAZY_SIZE) { + $this->logger->error( + '[Deprecated] App config {app}:{key} is larger than {maxSize} bytes. It should be declared as lazy.', + [ + 'app' => $app, + 'key' => $key, + 'maxSize' => self::MAX_NON_LAZY_SIZE, + ] + ); + } + if ($this->hasKey($app, $key, $lazy)) { /** * no update if key is already known with set lazy status and value is