From 5d0054b583a7a465baf3c8822c38aa410af6419e Mon Sep 17 00:00:00 2001 From: Ericson Soares Date: Fri, 1 Nov 2024 20:21:38 -0300 Subject: [PATCH] Error out when an empty list of allowed nodes is received. As it would indicate a possible misconfiguration elsewhere --- src/transport/iroh_net.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/transport/iroh_net.rs b/src/transport/iroh_net.rs index 6d67fc0..857f2a2 100644 --- a/src/transport/iroh_net.rs +++ b/src/transport/iroh_net.rs @@ -187,11 +187,10 @@ impl IrohNetServerEndpoint { let allowed_node_ids = match access_control { AccessControl::Unrestricted => BTreeSet::new(), AccessControl::Allowed(list) if list.is_empty() => { - tracing::warn!( - "Allowed list of `NodeId`s is empty, iroh-net \ - quic-rpc endpoint will have unrestricted access!" - ); - BTreeSet::new() + return Err(io::Error::other( + "Empty list of allowed nodes, \ + endpoint would reject all connections", + )); } AccessControl::Allowed(list) => BTreeSet::from_iter(list), }; @@ -203,7 +202,7 @@ impl IrohNetServerEndpoint { sender, allowed_node_ids, )); - + Ok(Self { inner: Arc::new(ServerEndpointInner { endpoint: Some(endpoint),