Enable credential masking for remote exec-server commands (#54309)

## What changed

Negotiate executor support for `credential_masking` and enable built-in credential brokerage in executor-local network proxies. Supported non-login Bash commands on Linux and macOS receive credential placeholders, with real credentials injected by the proxy for matching destinations.

Retain credential mappings across process launches within the same executor session, scoped by environment, conversation, and broker configuration. Keep credentials and destination context on the executor.

Fall back to unmasked execution for unsupported shells or shell startup, and for configured credential providers. Emit warnings when masking is unavailable, preserving shell profiles and snapshots.

## Testing

Add coverage for capability negotiation, fallback behavior, mapping reuse and isolation, proxy credential injection, and keeping executor credentials out of model-visible request history. Test warning, removal, and rejection modes for credentials left unmasked during preparation.

GitOrigin-RevId: f64e916a5de8350fa0d289d3440ec29761accd75
This commit is contained in:
viyatb-oai
2026-10-15 14:41:16 +00:00
committed by copyberry
parent 3ee47c1051
commit 7d33d0d93f
22 changed files with 1370 additions and 329 deletions
+24 -3
View File
@@ -334,6 +334,8 @@ impl NetworkProxyState {
pub fn from_remote_launch_config(
launch: crate::RemoteNetworkProxyLaunchConfig,
executor_os: crate::Platform,
credential_brokers: &crate::RemoteCredentialBrokerCache,
environment: &HashMap<String, String>,
) -> Result<Self> {
let crate::RemoteNetworkProxyLaunchConfig {
proxy,
@@ -346,9 +348,15 @@ impl NetworkProxyState {
proxy.enabled,
"executor-local network proxy launch requires an enabled proxy"
);
let config = proxy.into_network_proxy_config();
let mut config = proxy.into_network_proxy_config();
config.configure_credential_broker_environment(environment);
let state = build_config_state(config, NetworkProxyConstraints::default(), executor_os)?;
Ok(Self {
let cached_broker = credential_brokers.broker_if_enabled(
environment_id.as_deref(),
audit_metadata.conversation_id.as_deref(),
&state.config,
);
let mut proxy_state = Self {
environment_id: environment_id.map(Into::into),
execution_id: execution_id.map(Into::into),
..Self::with_reloader_and_audit_metadata(
@@ -357,7 +365,11 @@ impl NetworkProxyState {
audit_metadata,
LocalBindingPolicy::DefaultFalse,
)
})
};
if let Some(broker) = cached_broker {
proxy_state.credential_broker = broker;
}
Ok(proxy_state)
}
pub fn with_reloader(state: ConfigState, reloader: Arc<dyn ConfigReloader>) -> Self {
@@ -570,6 +582,15 @@ impl NetworkProxyState {
self.credential_broker.virtualize_text(text, env)
}
pub(crate) fn handle_unmasked_credentials(
&self,
env: &mut HashMap<String, String>,
mode: crate::CredentialMaskingFailureMode,
) -> anyhow::Result<()> {
self.credential_broker
.handle_unmasked_credentials(env, mode)
}
pub(crate) fn credential_broker_environment(
&self,
env: &HashMap<String, String>,