Security

Collections

A comprehensive guide to the dangers of Regular Expressions in JavaScript

This article explains how certain regex patterns can cause exponential backtracking on long strings, leading to regular expression denial of service (ReDoS) vulnerabilities.
Two real world examples caused major outages at Stack Overflow and CloudFlare due to unintentionally vulnerable regex use.

The article details how issues like excessive use of wildcards, quantifiers and overlapping patterns can cause catastrophic backtracking.
It also offers techniques for testing regex safety and fixing vulnerable patterns, such as limiting matches, using string methods instead of regex, and refactoring nested groups.
Overall, the article effectively raises awareness of the ReDoS threat within seemingly benign regex code.


Children
  1. 5 Software Security Goals All CTOs Should Prioritize
  2. API Security Best Practices - curity
  3. How to Secure Anything
  4. Security tools