From 48bee67b10485f6d982543f95f76a61be651d0a7 Mon Sep 17 00:00:00 2001 From: maslow Date: Wed, 22 Mar 2023 06:40:11 +0800 Subject: [PATCH] fix(server): add regex for environment name Signed-off-by: maslow --- server/src/application/dto/create-env.dto.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/src/application/dto/create-env.dto.ts b/server/src/application/dto/create-env.dto.ts index 16d5bc24a3..117b6b768a 100644 --- a/server/src/application/dto/create-env.dto.ts +++ b/server/src/application/dto/create-env.dto.ts @@ -1,11 +1,12 @@ import { ApiProperty } from '@nestjs/swagger' -import { IsNotEmpty, IsString, Length } from 'class-validator' +import { IsNotEmpty, IsString, Length, Matches } from 'class-validator' export class CreateEnvironmentDto { @ApiProperty() @IsNotEmpty() @IsString() @Length(1, 64) + @Matches(/^[a-zA-Z_][a-zA-Z0-9_]*$/) name: string @ApiProperty()