From a043a46457c20049f2922df60ea216fa795127a0 Mon Sep 17 00:00:00 2001 From: devlikepro Date: Tue, 5 Aug 2025 15:10:29 +0700 Subject: [PATCH] [core] API - limited characters in the session name fix #1163 --- src/structures/sessions.dto.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/structures/sessions.dto.ts b/src/structures/sessions.dto.ts index a8b7e6c8..80c327a7 100644 --- a/src/structures/sessions.dto.ts +++ b/src/structures/sessions.dto.ts @@ -7,6 +7,7 @@ import { IsBoolean, IsOptional, IsString, + Matches, MaxLength, ValidateNested, } from 'class-validator'; @@ -179,6 +180,10 @@ export class SessionCreateRequest { @IsString() @IsOptional() @MaxLength(DB_NAME_LIMIT - DB_NAME_MAX_PREFIX_LEN) + @Matches(/^[a-zA-Z0-9_-]*$/, { + message: + 'Session name can only contain alphanumeric characters, hyphens, and underscores (a-z, A-Z, 0-9, -, _) or be empty', + }) name: string | undefined; @ValidateNested()