From eb2fd83e61ac248d4baf4bbb91f2950e412412d1 Mon Sep 17 00:00:00 2001 From: Ali Behjati Date: Wed, 11 Oct 2023 18:13:35 +0200 Subject: [PATCH] fix(hermes): fix ip whitelisting logic --- hermes/src/api/ws.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hermes/src/api/ws.rs b/hermes/src/api/ws.rs index e7e96728..f903c30f 100644 --- a/hermes/src/api/ws.rs +++ b/hermes/src/api/ws.rs @@ -294,7 +294,8 @@ impl Subscriber { if !self .ws_state .bytes_limit_whitelist - .contains(&self.ip_addr.into()) + .iter() + .any(|ip_net| ip_net.contains(&self.ip_addr)) && self.ws_state.rate_limiter.check_key_n( &self.ip_addr, NonZeroU32::new(message.len().try_into()?).ok_or(anyhow!("Empty message"))?,