Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRAFT] Add support for blacklisted RPC endpoints #9056

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions crates/anvil/server/src/config.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand All @@ -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<String>,
}

impl ServerConfig {
Expand All @@ -39,6 +44,7 @@ impl Default for ServerConfig {
allow_origin: "*".parse::<HeaderValue>().unwrap().into(),
no_cors: false,
no_request_size_limit: false,
blacklist: HashSet::new(),
}
}
}
Expand Down