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

🐞 Wrong IP address validation #1209

Closed
bmolaga-r7 opened this issue Dec 3, 2019 · 5 comments
Closed

🐞 Wrong IP address validation #1209

bmolaga-r7 opened this issue Dec 3, 2019 · 5 comments
Labels

Comments

@bmolaga-r7
Copy link
Contributor

bmolaga-r7 commented Dec 3, 2019

TL;DR -
image

There is a bug in the ip validation function, it returns true for invalid ip addresses such as 10.0.0.01

validator.isIP('10.0.0.01');

expected false, returns true

@ezkemboi
Copy link
Member

ezkemboi commented Dec 4, 2019

I will do some investigation on this bug and I will get back to you.

@bmolaga-r7
Copy link
Contributor Author

I will do some investigation on this bug and I will get back to you.

Thanks. if I can help, found a working regex here - https://www.regextester.com/22
The main issue is from this line -

var ipv4Maybe = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;

@profnandaa
Copy link
Member

Good catch. PR welcome by all means! @barintsights

@bmolaga-r7
Copy link
Contributor Author

@profnandaa here you go #1211

profnandaa pushed a commit that referenced this issue Feb 11, 2020
* Bugfix - Wrong IP address validation
#1209

* Add tests for IPv4

Co-authored-by: Bar <[email protected]>
@johannesschobel
Copy link
Contributor

This Issue can be closed @profnandaa @ezkemboi @chriso - housekeeping ;)

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

No branches or pull requests

4 participants