From bdaf6442f78c30976353b2d70421d37d42f15c5e Mon Sep 17 00:00:00 2001 From: vichansson Date: Tue, 23 Apr 2024 19:22:51 +0300 Subject: [PATCH] M OpenNebula/one#5833: Make custom_attrs schema stricter (#3038) * Makes the NAME field a mandatory attribute + only allows alphanumeric chars and no spaces Signed-off-by: Victor Hansson --- .../CreateForm/Steps/Extra/customAttributes/schema.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/fireedge/src/client/components/Forms/ServiceTemplate/CreateForm/Steps/Extra/customAttributes/schema.js b/src/fireedge/src/client/components/Forms/ServiceTemplate/CreateForm/Steps/Extra/customAttributes/schema.js index 72613641168..be7a5253835 100644 --- a/src/fireedge/src/client/components/Forms/ServiceTemplate/CreateForm/Steps/Extra/customAttributes/schema.js +++ b/src/fireedge/src/client/components/Forms/ServiceTemplate/CreateForm/Steps/Extra/customAttributes/schema.js @@ -81,7 +81,13 @@ const NAME = { type: INPUT_TYPES.TEXT, validation: string() .trim() - .notRequired() + .lowercase() + .matches(/^[a-z0-9]*$/, { + message: + 'Name must only contain lowercase alphanumeric characters and no spaces', + excludeEmptyString: true, + }) + .required() .default(() => undefined), grid: { sm: 2.5, md: 2.5 }, }