From e4a2d59f0542dfdd3acd1bbd1c8ee11d0388285b Mon Sep 17 00:00:00 2001 From: Evan Date: Sun, 6 Apr 2025 10:43:37 -0700 Subject: [PATCH] allow empty string in SafeString --- src/core/Schemas.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/core/Schemas.ts b/src/core/Schemas.ts index 38ffa59fb..fc5d6fbf9 100644 --- a/src/core/Schemas.ts +++ b/src/core/Schemas.ts @@ -125,12 +125,9 @@ const GameConfigSchema = z.object({ const SafeString = z .string() - // Remove common dangerous characters and patterns - // The weird \u stuff is to allow emojis .regex( - /^[a-zA-Z0-9\s.,!?@#$%&*()-_+=\[\]{}|;:"'\/\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]|üÜ]+$/, + /^([a-zA-Z0-9\s.,!?@#$%&*()-_+=\[\]{}|;:"'\/\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]|üÜ])*$/, ) - // Reasonable max length to prevent DOS .max(1000); const EmojiSchema = z.string().refine(