From cacfb7755d9f152b9b1643ee4762a3648efa0a00 Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Tue, 26 Jul 2022 17:47:54 +0530 Subject: [PATCH] Common: Seperate regex for Windows and Linux filenames in CustomPBAConfigurationSchema --- .../agent_sub_configuration_schemas.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/monkey/common/agent_configuration/agent_sub_configuration_schemas.py b/monkey/common/agent_configuration/agent_sub_configuration_schemas.py index b1ae1c458..aaece7067 100644 --- a/monkey/common/agent_configuration/agent_sub_configuration_schemas.py +++ b/monkey/common/agent_configuration/agent_sub_configuration_schemas.py @@ -15,14 +15,19 @@ from .agent_sub_configurations import ( ) from .utils import freeze_lists -valid_custom_pba_filename_regex = re.compile(r"^([a-zA-Z0-9\ \._-]*)$") +valid_windows_custom_pba_filename_regex = re.compile(r"^[^<>:\"\\\/|?*]+[^<>:\"\\\/|?* \.]$") +valid_linux_custom_pba_filename_regex = re.compile(r"^[^\\]+$") class CustomPBAConfigurationSchema(Schema): linux_command = fields.Str() - linux_filename = fields.Str(validate=validate.Regexp(regex=valid_custom_pba_filename_regex)) + linux_filename = fields.Str( + validate=validate.Regexp(regex=valid_linux_custom_pba_filename_regex) + ) windows_command = fields.Str() - windows_filename = fields.Str(validate=validate.Regexp(regex=valid_custom_pba_filename_regex)) + windows_filename = fields.Str( + validate=validate.Regexp(regex=valid_windows_custom_pba_filename_regex) + ) @post_load def _make_custom_pba_configuration(self, data, **kwargs):