Validator.js: 馃悶 Wrong IP address validation

Created on 3 Dec 2019  路  5Comments  路  Source: validatorjs/validator.js

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

馃悰 bug

Most helpful comment

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 -
https://github.com/validatorjs/validator.js/blob/0d204da14f640fd2a8bf1874b6995128ff28409d/lib/isIP.js#L41

All 5 comments

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

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 -
https://github.com/validatorjs/validator.js/blob/0d204da14f640fd2a8bf1874b6995128ff28409d/lib/isIP.js#L41

Good catch. PR welcome by all means! @barintsights

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

spyshower picture spyshower  路  3Comments

jaxkodex picture jaxkodex  路  3Comments

IOAyman picture IOAyman  路  4Comments

rubiin picture rubiin  路  3Comments

mfbx9da4 picture mfbx9da4  路  4Comments