Description:
An AI-generated email regex with a repeated group that repeats inside, (x+)+, takes 1.2 seconds on a 30-character input and 5.4 seconds on 32 (measured on Node.js 22). Byte shows the catastrophic backtracking, the rule (never repeat a group that repeats) and the linear regex that answers in 0.07 ms, plus a length cap before any regex runs. Follow for the next episode.
Measured here: /^([a-zA-Z0-9]+\.?)+@[a-zA-Z0-9]+\.[a-zA-Z]{2,}$/ on 'a' repeated 30 times plus '!' took 1.26 s, on 32 characters 5.43 s (Node 22.23); Python's re took 15 s at 28 characters. The linear pattern /^[^\s@]+@[^\s@]+\.[^\s@]+$/ took 0.07 ms. A 2024 paper (arXiv 2401.12639) found 2 of 10 email regexes suggested by ChatGPT 3.5 would cause ReDoS; a 2025 study of ChatGPT-generated code (arXiv 2512.04259) flagged about 29% of 1,203 regexes as ReDoS-susceptible. Cloudflare's 2 July 2019 outage (27 minutes) was caused by a WAF regex containing .*(?:.*=.*). Byte's AI Lab: AI code reviews with real runs.
Sources
- https://community.owasp.org/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://blog.cloudflare.com/details-of-the-cloudflare-outage-on-july-2-2019/
- https://arxiv.org/abs/2401.12639
- https://arxiv.org/abs/2512.04259
Narration is AI-generated (synthetic voice); story, code and facts are checked against the sources above.
#ai #javascript #coding #cybersecurity #shorts
Share this link via
Or copy link























