fix: dont allow email exclusion bypass with capital letters (#24741)

* fix: dont allow email exclusion bypass with capital letters

* trim before lowercasing to filter out empty tokens

* update console message

* use only regex change to implement this

* use only regex change to implement this
This commit is contained in:
Dhairyashil Shinde
2025-11-03 11:59:14 +00:00
committed by GitHub
parent 99330b3117
commit 805c4d4c09
+1 -1
View File
@@ -796,7 +796,7 @@ export type FieldType = z.infer<typeof fieldTypeEnum>;
export const excludeOrRequireEmailSchema = z.string().superRefine((val, ctx) => {
const allDomains = val.split(",").map((dom) => dom.trim());
const regex = /^(?:@?[a-z0-9-]+(?:\.[a-z]{2,})?)?(?:@[a-z0-9-]+\.[a-z]{2,})?$/;
const regex = /^(?:@?[a-z0-9-]+(?:\.[a-z]{2,})?)?(?:@[a-z0-9-]+\.[a-z]{2,})?$/i;
/*
Valid patterns - [ example, example.anything, anyone@example.anything ]