-
-
Notifications
You must be signed in to change notification settings - Fork 710
fix: improve email validation regex #1251
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
Conversation
WalkthroughThe email validation logic in the email composer component was updated to use a more restrictive regular expression, tightening the criteria for what is considered a valid email address. No changes were made to exported or public entity declarations. Changes
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
apps/mail/components/create/email-composer.tsx (2)
65-65
: Add unit tests for email validation edge cases
There’s no existing test coverage for the updated regex. Please add unit tests covering both valid and invalid email samples (e.g., subdomains, plus‐addressing, quoted local parts) to prevent regressions.
64-67
: Align with Zod’s email validation
The form schema usesz.string().email()
which has its own rules. Consider reusing Zod’s validation or ensuring both validators behave identically to avoid inconsistent UX between form submission and inline entry.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/mail/components/create/email-composer.tsx
(1 hunks)
🔇 Additional comments (1)
apps/mail/components/create/email-composer.tsx (1)
65-65
: Ensure regex strictness matches requirements
The new pattern/^[a-zA-Z0-9._+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/
disallows characters that are technically valid per RFC (quotes, % signs, single quotes, numeric TLDs, etc.). Please verify that this narrower set of allowed emails aligns with your validation policy.
Description
implemented strict email validation .
before:

after:

Type of Change
Please delete options that are not relevant.
Areas Affected
Please check all that apply:
Testing Done
Describe the tests you've done:
Security Considerations
For changes involving data or authentication:
Checklist
Additional Notes
Add any other context about the pull request here.
Screenshots/Recordings
Add screenshots or recordings here if applicable.
By submitting this pull request, I confirm that my contribution is made under the terms of the project's license.
Summary by CodeRabbit