From 1c065e590bf47e00b4a4d4df348f6cee4afa7e85 Mon Sep 17 00:00:00 2001 From: teodorstupnicki Date: Tue, 8 Oct 2024 01:25:20 +0200 Subject: [PATCH] Added HashSet to ServerConfig to store blacklisted endpoints --- crates/anvil/server/src/config.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/anvil/server/src/config.rs b/crates/anvil/server/src/config.rs index dd15959b113a..414d912d5ae1 100644 --- a/crates/anvil/server/src/config.rs +++ b/crates/anvil/server/src/config.rs @@ -1,6 +1,7 @@ use crate::HeaderValue; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use std::str::FromStr; +use std::collections::HashSet; /// Additional server options. #[derive(Clone, Debug, Serialize, Deserialize)] @@ -17,6 +18,10 @@ pub struct ServerConfig { /// Disable the default request body size limit. At time of writing the default limit is 2MB. #[cfg_attr(feature = "clap", arg(long))] pub no_request_size_limit: bool, + + /// Blacklist of RPC methods to block. + #[cfg_attr(feature = "clap", arg(long, value_delimiter = ','))] + pub blacklist: HashSet, } impl ServerConfig { @@ -39,6 +44,7 @@ impl Default for ServerConfig { allow_origin: "*".parse::().unwrap().into(), no_cors: false, no_request_size_limit: false, + blacklist: HashSet::new(), } } }