frenchbread / private-ip

Check if IP address is private.
MIT License
33 stars 16 forks source link

fix: ipv4 getting rejected due to isIp package #6

Closed MrgSub closed 3 years ago

MrgSub commented 3 years ago

After doing my research, it appears that the IP 127.0.0.01 is getting rejected by isIp package

After the below change, 127.0.0.1 and 127.0.0.01 both returning true as private IPs

frenchbread commented 3 years ago

Hi @MrgSub,

Thank you for the PR!

Even though it seems to work, wouldn't it be wiser to patch is-ip module instead?

MrgSub commented 3 years ago

Hi @frenchbread Both valid options as I didn't find proper cases where this fails! Please do let me know if you come across any.

is-ip is using Regex expressions that are from another packages ip-regex so we'll need to patch that.

frenchbread commented 3 years ago

@MrgSub,

I can confirm that is-ip module rejects ip addresses with leading zeros. And your solution solves that issue but breaks some ipv6 tests for some reason.

I suggest that we open an issue on ip-regex.

frenchbread commented 3 years ago

It appears that another PR (#7) resolving this issue has been opened.

@MrgSub let me know if that works for you.

frenchbread commented 3 years ago

Closing this since the issue has been resolved.