fix CodeQL-Alerts

This commit is contained in:
2026-03-05 19:32:01 +01:00
parent b3c7a7bef3
commit d119ecf4a2
2 changed files with 8 additions and 3 deletions

View File

@@ -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);
});
}