-
Notifications
You must be signed in to change notification settings - Fork 157
Closed
Labels
needs implementer interestMoving the issue forward requires implementers to express interestMoving the issue forward requires implementers to express interesttopic: api
Description
Following discussion from nodejs/node#19595 cc @annevk @nodeav
At the moment URLs convert ports passed as numbers to strings in order to get the port number (specified in https://url.spec.whatwg.org/#port-state ). This is like the parseInt algorithm in that it ignores things after the first dot - which enables the following behavior:
var port = readPort(); // attacker returns 30 ** 30, , which gets coerced to 2.05891132094649e+44
// our validation: don't allow opening a connection to a lower-than 1024 port to the server.
if (typeof port !== 'number' || port < 1024) {
return false;
}
serverUrl.port = port; // port set to 2
download(serverUrl); // user connected to port we didn't mean them to be able to connect toThis is a feature request to validate and ignore passed numbers to the port setter.
nodeav and addaleax
Metadata
Metadata
Assignees
Labels
needs implementer interestMoving the issue forward requires implementers to express interestMoving the issue forward requires implementers to express interesttopic: api