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

Internal Error when authenticating request to /evolvi: ipaddr: cannot match ipv6 address with non-ipv6 one #165

Open
hardysabs2 opened this issue May 5, 2022 · 0 comments

Comments

@hardysabs2
Copy link

hardysabs2 commented May 5, 2022

Hi,

I am retrieving client ip(s) on an incoming request, from the header (x-forwarded-for) or from other request attribute(s).

I think I do not necessarily know if these will present as ipv6 or ipv4. However I have a set of valid ipv4 client addresses and a set of ipv4 CIDRs I am required to filter/authenticate against.

A straight match is easy to do check if any of each valid ipv4 addresses is included within incoming request client ip.

However when I try
var clientAddr = ipaddr.parse(clientIP.trim());
clientAddr.match(ipaddr.parseCIDR(validCIDR));

where validCIDR is always of the example form 111.111.111.144/29 , but clientIP may be of the example form "::ffff:127.0.0.1" or "127.0.0.1". I don't thin I can be sure.

What is the best way to account for this?

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

No branches or pull requests

1 participant