From a00a05d59838429ade02c1159a4a8255e63d7c28 Mon Sep 17 00:00:00 2001 From: whit3rabbit Date: Tue, 31 Mar 2026 17:21:06 -0500 Subject: [PATCH] fix(security): remove debug_assert that always fires inside #[tokio::main] --- crates/proxy/src/main.rs | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/crates/proxy/src/main.rs b/crates/proxy/src/main.rs index bace084..e2402e8 100644 --- a/crates/proxy/src/main.rs +++ b/crates/proxy/src/main.rs @@ -21,11 +21,6 @@ async fn main() { // ---- Phase 2: Apply env file vars (needed for RUST_LOG before tracing init) ---- // SAFETY: single-threaded, before tokio spawns workers. - // The debug_assert catches regressions if a spawn is added before this call. - debug_assert!( - tokio::runtime::Handle::try_current().is_err(), - "set_var called after tokio runtime started; this is unsound in a multi-threaded context" - ); unsafe { for (key, val) in &env_file_vars { std::env::set_var(key, val); @@ -65,10 +60,6 @@ async fn main() { // Apply alias overrides so config::MultiConfig::load() sees them. // SAFETY: still single-threaded at this point (no spawns yet). - debug_assert!( - tokio::runtime::Handle::try_current().is_err(), - "set_var called after tokio runtime started; this is unsound in a multi-threaded context" - ); unsafe { for (key, val) in &aliases { std::env::set_var(key, val); @@ -83,10 +74,6 @@ async fn main() { if let Some(ref mk) = load_result.litellm_master_key { if std::env::var("PROXY_API_KEYS").is_err() { // SAFETY: still single-threaded, no spawns yet. - debug_assert!( - tokio::runtime::Handle::try_current().is_err(), - "set_var called after tokio runtime started; this is unsound in a multi-threaded context" - ); unsafe { std::env::set_var("PROXY_API_KEYS", mk) }; tracing::info!("applied general_settings.master_key as PROXY_API_KEYS"); }