fix(pollux): add regex validation to prevent ReDoS in presentation verification
The validateField method in PresentationVerify passes the filter.pattern from the presentation definition directly to new RegExp() without any safety checks. An attacker can craft a presentation request with a regex pattern that causes catastrophic backtracking (e.g. (a|aa)+b), blocking the JavaScript event loop indefinitely. This is an unauthenticated attack vector since the presentation definition originates from an external verifier. Add a safeRegex utility that: - Validates the pattern is a non-empty string - Enforces a maximum pattern length of 256 characters - Verifies the pattern compiles as a valid regex - Detects and rejects patterns with nested quantifiers (ReDoS vectors) - Detects and rejects patterns with alternation inside quantified groups Fixes #646 Signed-off-by: A-Chronicle <[email protected]>