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)
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 fromsocket.localAddresson dual-stack systems.net.isIPv4("::ffff:10.0.0.1")returnsfalse, so the address falls through to the IPv6/hostname branch, producing a malformed SOCKS address.Suggested Fix
Strip the
::ffff:prefix before theisIPv4check:Environment