diff --git a/doc/api/cli.md b/doc/api/cli.md index ee4e9e85254135..b0909c677532d7 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -263,6 +263,38 @@ When passing a single flag with a comma a warning will be displayed. Examples can be found in the [File System Permissions][] documentation. +### `--allow-net` + + + +> Stability: 1.1 - Active development + +When using the [Permission Model][], the process will not be able to access +network by default. +Attempts to do so will throw an `ERR_ACCESS_DENIED` unless the +user explicitly passes the `--allow-net` flag when starting Node.js. + +Example: + +```js +const http = require('node:http'); +// Attempt to bypass the permission +const req = http.get('http://example.com', () => {}); + +req.on('error', (err) => { + console.log('err', err); +}); +``` + +```console +$ node --permission index.js +Error: connect ERR_ACCESS_DENIED Access to this API has been restricted. Use --allow-net to manage permissions. + code: 'ERR_ACCESS_DENIED', +} +``` + ### `--allow-wasi`