Skip to content

ipToSocksAddress does not handle IPv6-mapped IPv4 addresses (::ffff:x.x.x.x) #41107

Description

@pschroeder89

Description

ipToSocksAddress() in the SOCKS proxy does not handle IPv6-mapped IPv4 addresses (e.g., ::ffff:10.0.0.1). Node.js can return these from socket.localAddress on dual-stack systems.

net.isIPv4("::ffff:10.0.0.1") returns false, so the address falls through to the IPv6/hostname branch, producing a malformed SOCKS address.

Suggested Fix

Strip the ::ffff: prefix before the isIPv4 check:

function ipToSocksAddress(address) {
  if (/^::ffff:/i.test(address))
    address = address.slice(7);
  if (import_net2.default.isIPv4(address)) {
    // ...
  }
}

Environment

  • Playwright 1.60.0
  • Node.js 22.x (dual-stack networking)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions