* Activates inspector on host and port. * @param {number} [port] * @param {string} [host] * @param {boolean} [wait] * @returns {void}
(port, host, wait)
| 167 | * @returns {void} |
| 168 | */ |
| 169 | function inspectorOpen(port, host, wait) { |
| 170 | if (isEnabled()) { |
| 171 | throw new ERR_INSPECTOR_ALREADY_ACTIVATED(); |
| 172 | } |
| 173 | // inspectorOpen() currently does not typecheck its arguments and adding |
| 174 | // such checks would be a potentially breaking change. However, the native |
| 175 | // open() function requires the port to fit into a 16-bit unsigned integer, |
| 176 | // causing an integer overflow otherwise, so we at least need to prevent that. |
| 177 | if (isUint32(port)) { |
| 178 | validateInt32(port, 'port', 0, 65535); |
| 179 | } |
| 180 | if (host && !isLoopback(host)) { |
| 181 | process.emitWarning( |
| 182 | 'Binding the inspector to a public IP with an open port is insecure, ' + |
| 183 | 'as it allows external hosts to connect to the inspector ' + |
| 184 | 'and perform a remote code execution attack. ' + |
| 185 | 'Documentation can be found at ' + |
| 186 | 'https://nodejs.org/api/cli.html#--inspecthostport', |
| 187 | 'SecurityWarning', |
| 188 | ); |
| 189 | } |
| 190 | |
| 191 | open(port, host); |
| 192 | if (wait) |
| 193 | waitForDebugger(); |
| 194 | |
| 195 | return { __proto__: null, [SymbolDispose]() { _debugEnd(); } }; |
| 196 | } |
| 197 | |
| 198 | /** |
| 199 | * Blocks until a client (existing or connected later) |
nothing calls this directly
no test coverage detected
searching dependent graphs…