Add configurable credential providers to the network proxy (#44056)

## What changed

- Add `credential_providers` configuration for environment variables, credential patterns, static or environment-derived URL prefixes, and bearer, token, Basic, or custom header authentication.
- Generate matching dummy credentials and restrict replacement to authorized schemes, hosts, ports, and path prefixes. Scope credentials and destination history to each environment.
- Preserve real credentials for destinations that bypass the proxy with `allow_local_binding`, while providing snapshot redaction and alias matching.
- Validate provider definitions and preserve unchanged providers across configuration reloads.

## Testing

Add coverage for dummy generation, authentication translation, URL restrictions, environment isolation, configuration reloads, and credential restoration for local proxy bypass.

GitOrigin-RevId: 5d60ecc684cf4e9aa7637af33af12179aa0c672a
This commit is contained in:
Winston Howes authored and copyberry committed 2026-09-09 04:59:01 +00:00
1 parent 96c2b4377f
commit 1bfd383890
25 files changed
+3540 -299

No files matched your search

+4
View File
@@ -138,6 +138,8 @@ pub struct NetworkProxyConfig {
pub mitm: bool,
#[serde(default)]
pub credential_broker: bool,
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub credential_providers: BTreeMap<String, crate::CredentialProviderConfig>,
/// Trusted OpenAI endpoint derived from local configuration, never sent to remote executors.
#[serde(skip)]
pub credential_broker_openai_host: Option<String>,
@@ -164,6 +166,7 @@ impl Default for NetworkProxyConfig {
allow_local_binding: false,
mitm: false,
credential_broker: false,
credential_providers: BTreeMap::new(),
credential_broker_openai_host: None,
dangerously_allow_plaintext_credential_injection: false,
mitm_hooks: Vec::new(),
@@ -637,6 +640,7 @@ mod tests {
allow_local_binding: false,
mitm: false,
credential_broker: false,
credential_providers: BTreeMap::new(),
credential_broker_openai_host: None,
dangerously_allow_plaintext_credential_injection: false,
mitm_hooks: Vec::new(),