Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2021-04-06 19:00:44 +0300
committerRoeland Jago Douma <roeland@famdouma.nl>2021-04-08 12:55:51 +0300
commit2befac662c60110adfaaf382f12d7a4826379e9f (patch)
tree5c3f3ec23c86b0343f7e9c0fd0f77c98a37a27d8 /lib/private
parent365569f51c21a0848ef26679fa058cf4976bf9f8 (diff)
Limit size of properties to 2048 characters
It is unreasonable to expect that one of these fields would be longer than 2048 characters. Whilst some have definitely lower limits (such as for phone numbers or domain names), a upper bound as sanity check makes sense. Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/Accounts/AccountManager.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php
index 7b08fa3e598..ea8f99e0216 100644
--- a/lib/private/Accounts/AccountManager.php
+++ b/lib/private/Accounts/AccountManager.php
@@ -144,6 +144,17 @@ class AccountManager implements IAccountManager {
}
}
+ // set a max length
+ foreach ($data as $propertyName => $propertyData) {
+ if (isset($data[$propertyName]) && isset($data[$propertyName]['value']) && strlen($data[$propertyName]['value']) > 2048) {
+ if ($throwOnData) {
+ throw new \InvalidArgumentException($propertyName);
+ } else {
+ $data[$propertyName]['value'] = '';
+ }
+ }
+ }
+
$allowedScopes = [
self::SCOPE_PRIVATE,
self::SCOPE_LOCAL,