Skip to content

Commit f675331

Browse files
committed
fix: use safer email validation regex to prevent ReDoS
Replace the vulnerable email regex with a safer pattern that: - Uses explicit character class limits instead of negated classes - Limits local part to 1-64 characters - Limits domain to 1-255 characters - Limits TLD to 2-6 characters - Prevents catastrophic backtracking attacks
1 parent c2288fd commit f675331

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/tools/x509-certificate-generator/x509-certificate-generator.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ const emailValidation = useValidation({
320320
source: email,
321321
rules: [
322322
{
323-
validator: value => !value || /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value),
323+
validator: value => !value || /^[^@\s]{1,64}@[^@\s]{1,255}\.[^@\s]{2,6}$/.test(value),
324324
message: t('tools.x509-certificate-generator.invalidEmailFormat'),
325325
},
326326
],

0 commit comments

Comments
 (0)