wsproxy: stricter validation.
This commit is contained in:
parent
bcde9d59a7
commit
ac7f194c4d
@ -86,6 +86,12 @@ WSProxy.prototype._handleResolve = function _handleResolve(ws, name, record, cal
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (record !== 'A' && record !== 'AAAA') {
|
||||||
|
this.log('Client sent a bad record type: %s.', record);
|
||||||
|
ws.disconnect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!NAME_REGEX.test(name) || name.length > 200) {
|
if (!NAME_REGEX.test(name) || name.length > 200) {
|
||||||
this.log('Client sent a bad domain: %s.', name);
|
this.log('Client sent a bad domain: %s.', name);
|
||||||
ws.disconnect();
|
ws.disconnect();
|
||||||
@ -143,8 +149,8 @@ WSProxy.prototype._handleConnect = function _handleConnect(ws, port, host, nonce
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!/^[a-zA-Z0-9\.:\-]+$/.test(host)) {
|
if (IP.version(host) === -1) {
|
||||||
this.log('Client gave a bad host (%s).', state.host);
|
this.log('Client gave a bad host: %s (%s).', host, state.host);
|
||||||
ws.emit('tcp error', {
|
ws.emit('tcp error', {
|
||||||
message: 'EHOSTUNREACH',
|
message: 'EHOSTUNREACH',
|
||||||
code: 'EHOSTUNREACH'
|
code: 'EHOSTUNREACH'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user