A JavaScript library that adds timeout protection to regular expressions to prevent ReDoS attacks.
Super-regex is a JavaScript library that adds timeout functionality to regular expressions, preventing them from running indefinitely. It solves the problem of ReDoS (Regular Expression Denial of Service) attacks by allowing developers to set execution time limits, especially when handling untrusted user input.
JavaScript developers building web applications or servers that process user-generated content with regular expressions and need to mitigate security risks.
Developers choose Super-regex for its non-mutating API, cross-environment timeout support (including browsers via worker threads), and straightforward integration to enhance regex safety without complex configurations.
Make a regular expression time out if it takes too long to execute
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Adds timeout functionality to regex execution, explicitly preventing denial-of-service attacks from malicious input, as highlighted in the README's security focus.
Methods never mutate regex objects, even with the /g flag, avoiding bugs from state changes that occur with built-in methods like RegExp.test.
Async methods use worker threads to enable timeouts in both Node.js and browsers, making it versatile for client-side and server-side security.
Options like throwOnTimeout allow distinguishing between no matches and timeouts, providing fine-grained control over error responses.
Synchronous methods do not time out in browsers, limiting their utility for client-side security without switching to async methods, as admitted in the README.
Async methods spawn worker threads, adding performance overhead and complexity in resource-constrained environments, which can impact scalability.
Only addresses regex timeouts, not other regex-related issues like pattern validation or sanitization, requiring additional libraries for comprehensive security.