Skip to content
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

Update package.json for zod to 3.22.3 or greater #330

Merged
merged 2 commits into from Oct 3, 2023
Merged

Conversation

ceesss
Copy link
Contributor

@ceesss ceesss commented Oct 3, 2023

https://github.com/colinhacks/zod/releases/tag/v3.22.3

Fixes #2609

The current regex used for email validation contains "catastrophic backtracking", specifically ([A-Z0-9_+-]+.?)*. This gets evaluated inefficiently by JS, resulting in an exponential increase in execution time for failed matches.

This can be replicated easily - here's execution time against ^([A-Z0-9_+-]+.?)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9-].)+[A-Z]{2,}$

https://github.com/colinhacks/zod/releases/tag/v3.22.3

Fixes #2609

The current regex used for email validation contains "catastrophic backtracking", specifically ([A-Z0-9_+-]+\.?)*. This gets evaluated inefficiently by JS, resulting in an exponential increase in execution time for failed matches.

This can be replicated easily - here's execution time against ^([A-Z0-9_+-]+\.?)*[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$
@vercel
Copy link

vercel bot commented Oct 3, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
remix-validated-form ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 3, 2023 8:40pm

@airjp73
Copy link
Owner

airjp73 commented Oct 3, 2023

Hi! Thanks for taking the time to raise this issue and submit a PR! I was actually just working on a fix for this so I pushed those changes into this PR.

Unfortunately, we can't limit people from using zod versions less than 3.22.2, but we can update the peer dep to support it for those who are patching their zod dependency.

I also updated our zod dependency internally to the most recent version that doesn't suffer from #320.

@airjp73
Copy link
Owner

airjp73 commented Oct 3, 2023

It also looks like withZod will have to be updated to support some change in zod's types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants