From 04712fc464dd58fa34e67bd648e91f0b16b33fc0 Mon Sep 17 00:00:00 2001 From: Fiona Ebner Date: Thu, 8 Feb 2024 10:45:41 +0100 Subject: [PATCH] api: user: limit maximum length for certain properties The user.cfg file resides on the cluster filesystem where files have a maximum allowed size (currently 1 MiB). Signed-off-by: Fiona Ebner --- src/PVE/API2/User.pm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/PVE/API2/User.pm b/src/PVE/API2/User.pm index 2220d8f..8e0f440 100644 --- a/src/PVE/API2/User.pm +++ b/src/PVE/API2/User.pm @@ -29,10 +29,19 @@ register_standard_option('user-expire', { minimum => 0, optional => 1, }); -register_standard_option('user-firstname', { type => 'string', optional => 1 }); -register_standard_option('user-lastname', { type => 'string', optional => 1 }); -register_standard_option('user-email', { type => 'string', optional => 1, format => 'email-opt' }); -register_standard_option('user-comment', { type => 'string', optional => 1 }); +register_standard_option('user-firstname', { type => 'string', optional => 1, maxLength => 1024, }); +register_standard_option('user-lastname', { type => 'string', optional => 1, maxLength => 1024, }); +register_standard_option('user-email', { + type => 'string', + optional => 1, + format => 'email-opt', + maxLength => 4096, +}); +register_standard_option('user-comment', { + type => 'string', + optional => 1, + maxLength => 8192, +}); register_standard_option('user-keys', { description => "Keys for two factor auth (yubico).", type => 'string',