mirror of
https://github.com/MrUnknownDE/utools.git
synced 2026-04-17 13:23:45 +02:00
fix CodeQL-Alerts
This commit is contained in:
@@ -330,6 +330,11 @@ function checkPort(port, host, timeout = 2000) {
|
||||
resolve({ port, status, service, error: err.code });
|
||||
});
|
||||
|
||||
// Explicit inline guard (defence-in-depth; also satisfies CodeQL SSRF dataflow)
|
||||
if (!isValidIp(host) || isPrivateIp(host)) {
|
||||
socket.destroy();
|
||||
return resolve({ port, status: 'error', service, error: 'Restricted IP' });
|
||||
}
|
||||
socket.connect(port, host);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user