Add credential brokering to network proxy feature config (#40466)

## What changed

- Add `features.network_proxy.credential_broker` and preserve structured network proxy settings when toggling the feature through config APIs.
- Protect broker enablement and provider context variables from project config, while carrying trusted context into filtered shell environments.
- Propagate brokered credentials through shell snapshots and restore real credentials for unsandboxed escalated commands.
- Normalize broker context environment keys case-insensitively on Windows and avoid conflicting remote managed-network enforcement when no proxy launch configuration is available.

## Testing

- Cover config layering, editing, project sanitization, Windows environment handling, shell snapshots, escalated execution, and end-to-end GitHub credential brokering in the zsh-fork runtime.

GitOrigin-RevId: 500e51e804e1988022052ccfe00b8fac5e495f4f
This commit is contained in:
Winston Howes
2026-08-24 19:52:27 +00:00
committed by copyberry
parent c2904b9c5a
commit c3d5e4418f
27 changed files with 1000 additions and 92 deletions
@@ -137,6 +137,8 @@ where
// Step 4 - Apply user-provided overrides.
for (key, val) in &policy.r#set {
#[cfg(windows)]
env_map.retain(|existing, _| !existing.eq_ignore_ascii_case(key));
env_map.insert(key.clone(), val.clone());
}
@@ -248,6 +250,21 @@ mod windows_tests {
]);
assert_eq!(result, expected);
let policy = ShellEnvironmentPolicy {
inherit: ShellEnvironmentPolicyInherit::All,
ignore_default_excludes: true,
r#set: HashMap::from([("gh_host".to_string(), "github.trusted.example".to_string())]),
..Default::default()
};
assert_eq!(
populate_env(
make_vars(&[("GH_HOST", "github.stale.example")]),
&policy,
/*thread_id*/ None,
),
HashMap::from([("gh_host".to_string(), "github.trusted.example".to_string(),)]),
);
}
#[test]