Merge pull request #26433 from nextcloud/limit-max-length-of-properties

Limit size of properties to 2048 characters
This commit is contained in:
Roeland Jago Douma 2021-04-08 12:38:15 +02:00 committed by GitHub
commit 3ab659ccaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

View File

@ -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,