From a80d42271d356baace6490c764012e0cb585b8b9 Mon Sep 17 00:00:00 2001 From: soufiane Date: Fri, 5 Dec 2025 14:44:51 +0100 Subject: [PATCH] fix: replace vulnerable email regex with safe helper function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Use isValidEmail from helpers instead of inline regex - Fixes SonarQube Security Hotspot for DoS via backtracking 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/register/page.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/register/page.tsx b/app/register/page.tsx index 85dfb7f..a78986a 100644 --- a/app/register/page.tsx +++ b/app/register/page.tsx @@ -7,6 +7,7 @@ import { registerSchema, RegisterFormData } from "@/lib/validations"; import Link from "next/link"; import TeaIconsBackground from "@/components/TeaIconsBackground"; import { ROUTES, API_BASE_URL, API_ENDPOINTS } from "@/utils/constants"; +import { isValidEmail } from "@/utils/helpers"; import ReCAPTCHA from "react-google-recaptcha"; export default function RegisterPage() { @@ -42,7 +43,7 @@ export default function RegisterPage() { // Vérifier si l'email existe déjà const checkEmail = async (email: string) => { - if (!email || !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) { + if (!email || !isValidEmail(email)) { setEmailStatus({ checking: false, exists: null, valid: null, message: '' }); return; }