-
Notifications
You must be signed in to change notification settings - Fork 314
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
Mobile Number Validation Bug: Invalid Numbers Passing Validation #2591
Comments
I think we should add some proper validations instead of using regex pattern bcz
cc: @sainak |
Hi @vigneshhari, I see that PR #2588 has been merged into main. Should this GitHub issue be closed? |
@JohnLu2004 It was removed from the scope of #2588 , this issue need to be solved separately. |
Hi @DraKen0009 , Thanks for the follow-up. Could I be assigned this issue then? I'll use your comment as guidelines on how to properly validate |
@JohnLu2004 I'll suggest you to write down your approach and get it approve first before working on it. |
I've been checking out the issue and thinking about potential approaches to this issue. How do you feel about this approach on a high level?: Use a carrier lookup service to check whether the phone number is assigned to an active carrier. The overhead would be paying for a monthly service though. There are free tiers, but we would easily go over the monthly limit. We could also try OTP, but I think we would run into issues if a medical staff is entering in someone's phone number instead of the person themselves. |
@DraKen0009 @Jacobjeevan I've been checking out the current regex pattern and i found that their is some issues on Indian mobile number regex and international mobile number regex(inefficient and overly complex) , i can simplify them to work better . Should i start working on this issue. |
@ayushsaini7717 it's better to write down your approach if you have one , when asking to be assigned |
@DraKen0009 the current regex allows invalid numbers like +000000000000 or overly long ones, So Update the validation logic to enforce stricter rules may be a good approach in which numbers should start with '+', then having a valid country code and the last not be all zeroes and have a maximum of 15 digits with more efficient regix pattern. |
I'll suggest you to come up with the regex pattern first, bcz I did tried to use multiple patterns but wasn't able to find a acceptable solution. So try to come up with some regex, test it out thoroughly and let us know the results. |
Describe the bug
The mobile number validation allows invalid phone numbers like
+000000000000
and+9876543210123456
, which ideally should not be considered valid. This issue is due to a bug in the regular expression used in the validation logic.To Reproduce
Steps to reproduce the behavior:
+000000000000
or+9876543210123456
.Expected behavior
Phone numbers with formats like
+000000000000
and overly long sequences like+9876543210123456
should not pass validation.Additional context
This issue seems to be caused by the current regex pattern: regex link.
The text was updated successfully, but these errors were encountered: