-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zod email validation blocks the main thread in version 3.22.2 #2787
Comments
It's vulnerable to ReDoS attacks, as also mentioned in this issue. The linked issue contains a workaround by manually defining a zod string with a regex to parse the email address. |
Thanks for your reply. I noticed both of the versions are problematic. In version 3.22.2 it blocks the main thread if you do what I did in the provided video. But in 3.21.4 if you type "noreply1@1-90y790o645vz81zq6287dhb9x1x28ab4q521nuv7b1og4y9c3q.5r-h8uter0.sc016.case.sandbox.salesforce.com" it will also block the main thread. This email is provided in issue #2580 . Currently I am converting Currently both versions looks problematic and I didn't find any better way without using a regex. |
We can reproduce this error as well. Downgrading to 3.21.4 fixed it for us. |
It fixes the bug in the latest version but version 3.21.4 also has a bug that also blocks the main thread as I said. So, be careful 😉 |
Does that PR address this NVD ? |
Yes |
Fixed by #2824 Landed in Zod v3.22.3 |
Here is the version 3.21.4 of Zod:
zod-3.21.4.mp4
And here is the version 3.22.2:
zod-3.22.2.mp4
here is the demo code:
and I also tried something like this:
Both of them blocks the main thread and the second code doesn't even let me to see the page.
When I opened the performance tab in devtools I noticed it is doubling the time it takes the complete the task every time when I enter a new character to the input.
The text was updated successfully, but these errors were encountered: