Skip to content

Validate Organization Name on Frontend During Signup #3887

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

abimaelmartell
Copy link

Description 📣

This PR improves organization name validation during the signup flow by extracting the logic into a reusable utility function. It also replaces the boolean error flag with a more informative error message, improving user feedback.

Type ✨

  • Bug fix
  • New feature
  • Improvement
  • Breaking change
  • Documentation

Tests 🛠️

No automated tests were added since this change affects only client-side form validation and UI messaging. Let me know if you'd like me to add unit tests for the validator function.

# Steps to reproduce:
1. Go to the signup page
2. Leave the organization name field empty and try to submit – should show "Please enter your organization name"
3. Enter invalid characters like `!@#$`, should show an error about allowed characters
4. Enter a valid name, form should proceed without error

Should fix #3867


@maidul98
Copy link
Collaborator

maidul98 commented Jun 30, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

Adding frontend organization name validation during signup with potential security concerns in regex implementation.

  • New validateOrganizationName utility potentially vulnerable to ReDoS attacks due to using native regex instead of RE2 package for validation, needs security review
  • Organization name validation message states dashes (-) but implementation allows underscores (_), causing documentation/implementation mismatch
  • Error state in UserInfoStep.tsx changed from boolean to string|null improving UX with specific error messages
  • Consider adding unit tests despite being UI changes to ensure validation edge cases are covered

2 files reviewed, 2 comments
Edit PR Review Bot Settings | Greptile

return "Please enter your organization name";
}

if (!/^[a-zA-Z0-9\s\-_]+$/.test(name)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: ReDoS vulnerability risk. Replace with RE2 package for safer regex validation as per Rule 1

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.

Sign-up request fails when using organization name with special characters such as &
2 participants