mirror of
https://github.com/openai/codex.git
synced 2026-12-04 00:51:02 +00:00
## What changed - Load `application.network` requirements at startup and explicit config/account reloads, applying local policy before authentication and cloud configuration bootstrap. - Block traffic when policy loading fails, cancel requests that a new policy no longer permits, and reject configuration loads based on superseded policy snapshots. Local requirements edits take effect on the next explicit reload or restart. - Bind authenticated clients to the current account and revoke them when account ownership changes. Carry policy enforcement through backend requests, realtime connections, workload identity exchanges, and code-mode gRPC streams while preserving gRPC trailers. - Treat denied credential refreshes as policy errors without retrying them or invalidating stored credentials. ## Testing Add regression coverage for startup restrictions, reload ordering, cancellation after restrictive or malformed requirements edits, account revocation, gRPC destination denial, workload identity cancellation, and credential preservation after denied OAuth refresh. GitOrigin-RevId: 0cb4c720a906397e9df06675f01ecf60d741101f
38 lines
1.4 KiB
Rust
38 lines
1.4 KiB
Rust
//! Validated TLS material for strict, route-aware HTTP clients.
|
|
//! Explicit roots replace shared environment roots; PEM identities require HTTPS and rustls.
|
|
|
|
use std::fmt;
|
|
|
|
use crate::HttpError;
|
|
|
|
/// TLS configuration consumed by [`crate::HttpClientBuilder::build_with_tls`].
|
|
/// Keeping this separate from the builder prevents combining it with legacy fallback APIs.
|
|
#[derive(Clone, Default)]
|
|
pub struct HttpClientTlsConfig {
|
|
pub(crate) root_certificate: Option<reqwest::Certificate>,
|
|
pub(crate) client_identity: Option<reqwest::Identity>,
|
|
}
|
|
|
|
impl fmt::Debug for HttpClientTlsConfig {
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
f.debug_struct("HttpClientTlsConfig")
|
|
.field("explicit_root", &self.root_certificate.is_some())
|
|
.field("client_identity", &self.client_identity.is_some())
|
|
.finish()
|
|
}
|
|
}
|
|
|
|
impl HttpClientTlsConfig {
|
|
/// Trusts this PEM certificate instead of system or environment-provided roots.
|
|
pub fn with_root_certificate_pem(mut self, pem: &[u8]) -> Result<Self, HttpError> {
|
|
self.root_certificate = Some(reqwest::Certificate::from_pem(pem)?);
|
|
Ok(self)
|
|
}
|
|
|
|
/// Installs a PEM certificate chain and private key and requires HTTPS requests.
|
|
pub fn with_client_identity_pem(mut self, pem: &[u8]) -> Result<Self, HttpError> {
|
|
self.client_identity = Some(reqwest::Identity::from_pem(pem)?);
|
|
Ok(self)
|
|
}
|
|
}
|