Skip to content

Commit

Permalink
Error out when an empty list of allowed nodes is received.
Browse files Browse the repository at this point in the history
As it would indicate a possible misconfiguration elsewhere
  • Loading branch information
fogodev committed Nov 1, 2024
1 parent 4307dfb commit 5d0054b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/transport/iroh_net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,10 @@ impl<In: RpcMessage, Out: RpcMessage> IrohNetServerEndpoint<In, Out> {
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),
};
Expand All @@ -203,7 +202,7 @@ impl<In: RpcMessage, Out: RpcMessage> IrohNetServerEndpoint<In, Out> {
sender,
allowed_node_ids,
));

Ok(Self {
inner: Arc::new(ServerEndpointInner {
endpoint: Some(endpoint),
Expand Down

0 comments on commit 5d0054b

Please sign in to comment.