From 7669ffeb7c21a60997ff5af5cfba64d393a8f45d Mon Sep 17 00:00:00 2001 From: Toshit Chawda Date: Mon, 25 Nov 2024 14:28:59 -0800 Subject: [PATCH] disallow unknown fields in config --- server/src/config.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/src/config.rs b/server/src/config.rs index 7c1f4f1..aee7f43 100644 --- a/server/src/config.rs +++ b/server/src/config.rs @@ -84,7 +84,7 @@ pub enum StatsEndpoint { } #[derive(Debug, Serialize, Deserialize)] -#[serde(default)] +#[serde(default, deny_unknown_fields)] pub struct ServerConfig { /// Address and socket type to listen on. pub bind: BindAddr, @@ -147,7 +147,7 @@ fn is_default_motd(str: &String) -> bool { } #[derive(Debug, Serialize, Deserialize)] -#[serde(default)] +#[serde(default, deny_unknown_fields)] pub struct WispConfig { /// Allow legacy wsproxy connections. pub allow_wsproxy: bool, @@ -185,7 +185,7 @@ pub struct WispConfig { } #[derive(Debug, Serialize, Deserialize)] -#[serde(default)] +#[serde(default, deny_unknown_fields)] pub struct StreamConfig { /// Whether or not to enable TCP nodelay. pub tcp_nodelay: bool, @@ -237,7 +237,7 @@ pub struct StreamConfig { } #[derive(Debug, Serialize, Deserialize, Default)] -#[serde(default)] +#[serde(default, deny_unknown_fields)] pub struct Config { /// Server-specific config. pub server: ServerConfig,