From f0d5c31118432897c8d23de28dc0a4b647a016f1 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Thu, 7 May 2026 21:34:40 -0700 Subject: [PATCH] quic: support --allow-net permissions Signed-off-by: James M Snell Assisted-by: Opencode:Opus 4.6 --- doc/api/quic.md | 20 +++++++++ src/quic/endpoint.cc | 6 +++ test/cctest/test_sockaddr.cc | 2 +- test/parallel/test-permission-net-quic.mjs | 50 ++++++++++++++++++++++ 4 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 test/parallel/test-permission-net-quic.mjs diff --git a/doc/api/quic.md b/doc/api/quic.md index ddeafdc8d3edd1..ecd0d73803888a 100644 --- a/doc/api/quic.md +++ b/doc/api/quic.md @@ -304,6 +304,24 @@ When a `QuicError` is passed to [`stream.destroy()`][] or `STOP_SENDING` frame sent to the peer. Any other error type falls back to the negotiated protocol's generic internal error code. +### Permission model + +When using the [Permission Model][], the `--allow-net` flag must be passed to +allow QUIC network operations. Without it, calling [`quic.connect()`][] or +[`quic.listen()`][] will throw an `ERR_ACCESS_DENIED` error. + +```console +$ node --permission --allow-fs-read=* --experimental-quic index.mjs +Error: Access to this API has been restricted. Use --allow-net to manage permissions. + code: 'ERR_ACCESS_DENIED', + permission: 'Net', +} +``` + +Creating a [`QuicEndpoint`][] instance without connecting or listening +is permitted even without `--allow-net`, since no network I/O occurs until +[`quic.connect()`][] or [`quic.listen()`][] is called. + ## `quic.connect(address[, options])`