noobaa / noobaa-core

High-performance S3 application gateway to any backend - file / s3-compatible / multi-clouds / caching / replication ...
https://www.noobaa.io
Apache License 2.0
273 stars 80 forks source link

remove link-local suffix from remoteAddress in ice.js #8535

Closed dannyzaken closed 6 days ago

dannyzaken commented 1 week ago

Explain the changes

  1. in node js 22, in some cases, socket.remoteAddress contains a link-local suffix, e.g.: fe80::858:aff:fe83:2e%eth0
  2. This address format is not parsed correctly by ip_module.isPrivate() (npm ip module), and throws an error invalid ipv4 address
  3. changed ice.js only to remove the %[interface] suffix.
  4. wrapped ip_module.isPrivate() with a non-throwing function

Issues: Fixed #xxx / Gap #xxx

Testing Instructions:

dannyzaken commented 1 week ago

I am not sure what the correct address value should be used. The link-local format is valid but is not handled correctly by some applications. The previous behavior of node.js 20 (remoteAddress without the link-local suffix) worked for us, so I patched it, but only on ice.js. If we will see other failures as a result of this address suffix we will consider a more general fix.