Skip to content
Merged
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
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.

Backport of #26433

Signed-off-by: Lukas Reschke <[email protected]>
  • Loading branch information
LukasReschke authored and rullzer committed Apr 29, 2021
commit 845a67c02b3da3b758aebfe2b05285f8974458ea
8 changes: 8 additions & 0 deletions lib/private/Accounts/AccountManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ public function __construct(IDBConnection $connection,
public function updateUser(IUser $user, $data) {
$userData = $this->getUser($user);
$updated = true;

// set a max length
foreach ($data as $propertyName => $propertyData) {
if (isset($data[$propertyName]) && isset($data[$propertyName]['value']) && strlen($data[$propertyName]['value']) > 2048) {
$data[$propertyName]['value'] = '';
}
}

if (empty($userData)) {
$this->insertNewUser($user, $data);
} elseif ($userData !== $data) {
Expand Down