From f28f689841b8c077fad5abbc1b4cf0ae0e15c9fb Mon Sep 17 00:00:00 2001 From: amcmanu3 Date: Fri, 31 May 2024 15:31:42 -0400 Subject: [PATCH] Do not allow slashes in server names --- app/classes/web/routes/api/servers/index.py | 1 + app/classes/web/routes/api/servers/server/index.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/classes/web/routes/api/servers/index.py b/app/classes/web/routes/api/servers/index.py index 43cf01e2..ca551326 100644 --- a/app/classes/web/routes/api/servers/index.py +++ b/app/classes/web/routes/api/servers/index.py @@ -23,6 +23,7 @@ new_server_schema = { "type": "string", "examples": ["My Server"], "minLength": 2, + "pattern": "^[^/\\\\]*$", }, "roles": {"title": "Roles to add", "type": "array", "examples": [1, 2, 3]}, "stop_command": { diff --git a/app/classes/web/routes/api/servers/server/index.py b/app/classes/web/routes/api/servers/server/index.py index 9bfc3a9a..3562334c 100644 --- a/app/classes/web/routes/api/servers/server/index.py +++ b/app/classes/web/routes/api/servers/server/index.py @@ -12,7 +12,7 @@ logger = logging.getLogger(__name__) server_patch_schema = { "type": "object", "properties": { - "server_name": {"type": "string", "minLength": 1}, + "server_name": {"type": "string", "minLength": 2, "pattern": "^[^/\\\\]*$"}, "backup_path": {"type": "string"}, "executable": {"type": "string"}, "log_path": {"type": "string", "minLength": 1},