@@ -1943,11 +1943,17 @@ void GetNameInfo(const FunctionCallbackInfo<Value>& args) {
19431943 TRACING_CATEGORY_NODE2 (dns, native), " lookupService" , req_wrap.get (),
19441944 " ip" , TRACE_STR_COPY (*ip), " port" , port);
19451945
1946- // TODO: check?
1947- int err = req_wrap->Dispatch (uv_getnameinfo,
1948- AfterGetNameInfo,
1949- reinterpret_cast <struct sockaddr *>(&addr),
1950- NI_NAMEREQD);
1946+ int err = 0 ;
1947+ if (!env->permission ()->is_granted (
1948+ env, permission::PermissionScope::kNet , ip.ToStringView ())) [[unlikely]] {
1949+ req_wrap->InsufficientPermissionError (*ip);
1950+ } else {
1951+ err = req_wrap->Dispatch (uv_getnameinfo,
1952+ AfterGetNameInfo,
1953+ reinterpret_cast <struct sockaddr *>(&addr),
1954+ NI_NAMEREQD);
1955+ }
1956+
19511957 if (err == 0 )
19521958 // Release ownership of the pointer allowing the ownership to be transferred
19531959 USE (req_wrap.release ());
@@ -1965,6 +1971,7 @@ void GetServers(const FunctionCallbackInfo<Value>& args) {
19651971
19661972 ares_addr_port_node* servers;
19671973
1974+ // TODO: check
19681975 int r = ares_get_servers_ports (channel->cares_channel (), &servers);
19691976 CHECK_EQ (r, ARES_SUCCESS);
19701977 auto cleanup = OnScopeLeave ([&]() { ares_free_data (servers); });
@@ -2009,6 +2016,7 @@ void SetServers(const FunctionCallbackInfo<Value>& args) {
20092016
20102017 uint32_t len = arr->Length ();
20112018
2019+ // TODO: check
20122020 if (len == 0 ) {
20132021 int rv = ares_set_servers (channel->cares_channel (), nullptr );
20142022 return args.GetReturnValue ().Set (rv);
0 commit comments