diff --git a/src/pipe_wrap.cc b/src/pipe_wrap.cc index 5100b0fed17455..4b4966f5f80e74 100644 --- a/src/pipe_wrap.cc +++ b/src/pipe_wrap.cc @@ -211,6 +211,8 @@ void PipeWrap::Open(const FunctionCallbackInfo& args) { int fd; if (!args[0]->Int32Value(env->context()).To(&fd)) return; + THROW_IF_INSUFFICIENT_PERMISSIONS(env, permission::PermissionScope::kNet, ""); + int err = uv_pipe_open(&wrap->handle_, fd); if (err == 0) wrap->set_fd(fd); diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc index 466b0f8938c699..492afe58495506 100644 --- a/src/tcp_wrap.cc +++ b/src/tcp_wrap.cc @@ -361,6 +361,10 @@ void TCPWrap::Open(const FunctionCallbackInfo& args) { TCPWrap* wrap; ASSIGN_OR_RETURN_UNWRAP( &wrap, args.This(), args.GetReturnValue().Set(UV_EBADF)); + Environment* env = wrap->env(); + + THROW_IF_INSUFFICIENT_PERMISSIONS(env, permission::PermissionScope::kNet, ""); + int64_t val; if (!args[0]->IntegerValue(args.GetIsolate()->GetCurrentContext()).To(&val)) return; diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc index b5e732dd6f1cb4..45d884ee91fd54 100644 --- a/src/udp_wrap.cc +++ b/src/udp_wrap.cc @@ -368,6 +368,10 @@ void UDPWrap::Open(const FunctionCallbackInfo& args) { UDPWrap* wrap; ASSIGN_OR_RETURN_UNWRAP( &wrap, args.This(), args.GetReturnValue().Set(UV_EBADF)); + Environment* env = wrap->env(); + + THROW_IF_INSUFFICIENT_PERMISSIONS(env, permission::PermissionScope::kNet, ""); + CHECK(args[0]->IsNumber()); int fd = FromV8Value(args[0]); int err = uv_udp_open(&wrap->handle_, fd);