whitequark / whitequark/ipaddr.js

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

Open
#165 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
654
Forks
104
Avg merge
3h 18m
Merged PRs (30d)
1

Description

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?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the reported request-authentication flow and the ipaddr.parse, parseCIDR, and match calls described in the issue. Reproduce the IPv4-versus-IPv6 mismatch with the example addresses, then determine the expected behavior and document or test a confirmed resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.