mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
Preserve account network policy for ChatGPT backend requests (#47703)
## Why ChatGPT backend requests could bypass the configured network policy by using a default HTTP client. Requests using captured credentials must also retain the corresponding account policy so revocation continues to block them. ## What changed - Use the configured HTTP client factory for ChatGPT GET and POST requests, enforcing managed network policy while retaining cookies. - Capture authentication and network policy together for app reads and plugin reads and installs, preserving that policy across the post-install configuration reload. - Bind GET requests to the current account policy before loading credentials. ## Testing Add regression tests for revoked account policies, blocked connector destinations, and network policy enforcement after configuration reload with a cached app client. GitOrigin-RevId: 5298842eec9664af49df70e89624653d1452fb33
This commit is contained in:
@@ -26,8 +26,14 @@ impl AppsRequestProcessor {
|
||||
.into_iter()
|
||||
.filter(|app_id| seen_app_ids.insert(app_id.clone()))
|
||||
.collect::<Vec<_>>();
|
||||
let config = self.load_apps_config(thread_id.as_deref()).await?;
|
||||
let auth = self.auth_manager.auth().await;
|
||||
let mut config = self.load_apps_config(thread_id.as_deref()).await?;
|
||||
let auth = match self.auth_manager.auth_with_http_client_factory().await {
|
||||
Some((auth, factory)) => {
|
||||
config.application_network_policy = factory.network_policy().clone();
|
||||
Some(auth)
|
||||
}
|
||||
None => None,
|
||||
};
|
||||
if !config
|
||||
.features
|
||||
.apps_enabled_for_auth(auth.as_ref().is_some_and(CodexAuth::uses_codex_backend))
|
||||
|
||||
Reference in New Issue
Block a user