Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions lib/private/AppConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, array<string, string>> ['app_id' => ['config_key' => 'config_value']] */
private array $fastCache = []; // cache for normal config keys
Expand Down Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions lib/private/Config/UserConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<array<string, array<string, UserConfigEntry>>> cache for normal config keys */
private CappedMemoryCache $fastCache;
Expand Down Expand Up @@ -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;
Expand Down
Loading