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.
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?