Skip to content

Commit

Permalink
Merge pull request #26433 from nextcloud/limit-max-length-of-properties
Browse files Browse the repository at this point in the history
Limit size of properties to 2048 characters
  • Loading branch information
rullzer committed Apr 8, 2021
2 parents 365569f + 2befac6 commit 3ab659c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/private/Accounts/AccountManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,17 @@ public function updateUser(IUser $user, array $data, bool $throwOnData = false):
}
}

// 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,
Expand Down

0 comments on commit 3ab659c

Please sign in to comment.