/** * Copyright (c) 2025 Ofri Peretz * Licensed under the MIT License. Use of this source code is governed by the * MIT license that can be found in the LICENSE file. */ /** * ESLint Rule: detect-non-literal-regexp * Detects RegExp(variable), which might allow an attacker to DOS your server with a long-running regular expression * LLM-optimized with comprehensive ReDoS prevention guidance * * @see https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS * @see https://cwe.mitre.org/data/definitions/400.html */ import type { TSESLint } from '@interlace/eslint-devkit'; type MessageIds = 'regexpReDoS' | 'useStaticRegex' | 'validateInput' | 'useRegexLibrary' | 'addTimeout' | 'escapeUserInput'; export interface Options { /** Allow literal string regex patterns. Default: false (stricter) */ allowLiterals?: boolean; /** Additional RegExp creation patterns to check */ additionalPatterns?: string[]; /** Maximum allowed pattern length for dynamic regex */ maxPatternLength?: number; } type RuleOptions = [Options?]; export declare const detectNonLiteralRegexp: TSESLint.RuleModule & { name: string; }; export {};