aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2021-04-06 16:00:44 +0000
committerRoeland Jago Douma <roeland@famdouma.nl>2021-04-08 11:55:51 +0200
commit2befac662c60110adfaaf382f12d7a4826379e9f (patch)
tree5c3f3ec23c86b0343f7e9c0fd0f77c98a37a27d8 /lib
parent365569f51c21a0848ef26679fa058cf4976bf9f8 (diff)
downloadnextcloud-server-2befac662c60110adfaaf382f12d7a4826379e9f.tar.gz
nextcloud-server-2befac662c60110adfaaf382f12d7a4826379e9f.zip
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')
-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,