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:
jackz
2026-09-24 00:50:02 +00:00
committed by copyberry
parent d838c2346d
commit d04b0561d3
6 changed files with 183 additions and 35 deletions
@@ -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))