Skip to content

ReDoS checker test fail on Node 22 #5365

@1knair

Description

@1knair

Environment: Windows 11, Node 22.19.0, pnpm 10.12.1

How to reproduce:
(Clone repo and install deps with Node 22)

git clone https://github.com/colinhacks/zod.git
cd zod
pnpm install
pnpm -w vitest --run src/v4/classic/tests/datetime.test.ts -t "redos checker"

Result:
FAIL src/v4/classic/tests/datetime.test.ts > redos checker
Error: ReDoS issue
at Object. (src/v4/classic/tests/datetime.test.ts:300:41)

Result: test throws error "ReDoS issue"
Expected: all tests pass

Likely caused by Node 22 regex engine changes. All other 2996 tests pass.
Running the same test on Node 20 LTS passes successfully.
Failure originates from checkSync(schema._zod.pattern.source, "") that uses recheck library for ReDoS detection.
Could stem from updates to V8’s RegExp engine in Node 22 that tightens recheck’s detection .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions