/** * Regex Executor - Timeout-Protected Regex Execution * * Executes regex patterns with timeout protection to prevent ReDoS attacks. * Even if a dangerous pattern passes validation, execution will be aborted * if it takes too long. * * This provides defense-in-depth: validation catches obvious issues, * timeout catches edge cases and ensures fail-safe behavior. */ import { type RegexValidationOptions } from './regex-validator.js'; export interface RegexExecutionOptions { /** * Maximum execution time in milliseconds (default: 100ms) * If regex.test() takes longer, it will be aborted */ timeout?: number; /** * Validation options (passed to RegexValidator) */ validationOptions?: RegexValidationOptions; } /** * Safe regex executor with validation and timeout protection */ export declare class RegexExecutor { /** * Test if a string matches a regex pattern (with safety checks) * * @param pattern - Regex pattern string * @param input - Input string to test * @param options - Execution options * @returns true if match, false otherwise * @throws {SecurityError} if pattern is unsafe or execution times out */ static test(pattern: string, input: string, options?: RegexExecutionOptions): boolean; /** * Execute regex with timeout * * Note: JavaScript doesn't have native regex timeout, so we use timing checks. * This isn't perfect (can't interrupt running regex) but provides reasonable protection. */ private static executeWithTimeout; /** * Matches function - similar to test() but can be used inline * Useful for filter expressions: matches(@.value, "pattern") */ static matches(input: string, pattern: string, options?: RegexExecutionOptions): boolean; } /** * Helper: Create a safe regex tester function * Returns a function that can be reused for multiple tests with same pattern */ export declare function createSafeRegexTester(pattern: string, options?: RegexExecutionOptions): (input: string) => boolean; //# sourceMappingURL=regex-executor.d.ts.map