mirror of
https://github.com/openai/codex.git
synced 2026-10-22 17:58:46 +00:00
Merge branch 'dev/winston/credentialed-routes-proxy-rebase' into dev/winston/credentialed-routes-backend-adapter-review-20260618
This commit is contained in:
@@ -729,11 +729,6 @@ mod tests {
|
||||
use std::net::IpAddr;
|
||||
use std::net::Ipv4Addr;
|
||||
use std::sync::Arc;
|
||||
use std::sync::Mutex;
|
||||
|
||||
// Managed MITM CA files live under the shared test CODEX_HOME, so MITM-enabled config state
|
||||
// must be materialized one test at a time.
|
||||
static MITM_CONFIG_STATE_LOCK: Mutex<()> = Mutex::new(());
|
||||
|
||||
#[derive(Clone)]
|
||||
struct StaticReloader {
|
||||
@@ -756,10 +751,6 @@ mod tests {
|
||||
|
||||
fn state_for_settings(network: NetworkProxySettings) -> Arc<NetworkProxyState> {
|
||||
let config = NetworkProxyConfig { network };
|
||||
let _mitm_config_state_guard = config
|
||||
.network
|
||||
.mitm
|
||||
.then(|| MITM_CONFIG_STATE_LOCK.lock().unwrap());
|
||||
let state = build_config_state(config, NetworkProxyConstraints::default()).unwrap();
|
||||
let reloader = Arc::new(StaticReloader {
|
||||
state: state.clone(),
|
||||
|
||||
@@ -15,6 +15,8 @@ use crate::runtime::ConfigState;
|
||||
use serde::Deserialize;
|
||||
use std::collections::HashSet;
|
||||
use std::sync::Arc;
|
||||
#[cfg(test)]
|
||||
use std::sync::Mutex;
|
||||
|
||||
pub use crate::runtime::BlockedRequest;
|
||||
pub use crate::runtime::BlockedRequestArgs;
|
||||
@@ -23,6 +25,10 @@ pub use crate::runtime::NetworkProxyState;
|
||||
#[cfg(test)]
|
||||
pub(crate) use crate::runtime::network_proxy_state_for_policy;
|
||||
|
||||
// Managed MITM CA files live under the shared test CODEX_HOME.
|
||||
#[cfg(test)]
|
||||
static MITM_CONFIG_STATE_LOCK: Mutex<()> = Mutex::new(());
|
||||
|
||||
#[derive(Debug, Default, Clone, PartialEq, Eq)]
|
||||
pub struct NetworkProxyConstraints {
|
||||
pub enabled: Option<bool>,
|
||||
@@ -65,6 +71,11 @@ pub fn build_config_state(
|
||||
config: NetworkProxyConfig,
|
||||
constraints: NetworkProxyConstraints,
|
||||
) -> anyhow::Result<ConfigState> {
|
||||
#[cfg(test)]
|
||||
let _mitm_config_state_guard = config
|
||||
.network
|
||||
.mitm
|
||||
.then(|| MITM_CONFIG_STATE_LOCK.lock().unwrap());
|
||||
crate::config::validate_unix_socket_allowlist_paths(&config)?;
|
||||
let allowed_domains = config.network.allowed_domains().unwrap_or_default();
|
||||
let denied_domains = config.network.denied_domains().unwrap_or_default();
|
||||
|
||||
Reference in New Issue
Block a user