Skip to content

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

@hardysabs2

Description

@hardysabs2

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions