feat: introduce EffectivePermissions

This commit is contained in:
Michael Bolin
2026-02-12 12:39:41 -08:00
parent 466be55abc
commit 937f1e0003
29 changed files with 381 additions and 190 deletions
@@ -1677,11 +1677,14 @@ impl CodexMessageProcessor {
}
let cwd = params.cwd.unwrap_or_else(|| self.config.cwd.clone());
let env = create_env(&self.config.shell_environment_policy, None);
let env = create_env(
&self.config.effective_permissions.shell_environment_policy,
None,
);
let timeout_ms = params
.timeout_ms
.and_then(|timeout_ms| u64::try_from(timeout_ms).ok());
let started_network_proxy = match self.config.network.as_ref() {
let started_network_proxy = match self.config.effective_permissions.network.as_ref() {
Some(spec) => match spec.start_proxy().await {
Ok(started) => Some(started),
Err(err) => {
@@ -1713,7 +1716,12 @@ impl CodexMessageProcessor {
let requested_policy = params.sandbox_policy.map(|policy| policy.to_core());
let effective_policy = match requested_policy {
Some(policy) => match self.config.sandbox_policy.can_set(&policy) {
Some(policy) => match self
.config
.effective_permissions
.sandbox_policy
.can_set(&policy)
{
Ok(()) => policy,
Err(err) => {
let error = JSONRPCErrorError {
@@ -1725,7 +1733,12 @@ impl CodexMessageProcessor {
return;
}
},
None => self.config.sandbox_policy.get().clone(),
None => self
.config
.effective_permissions
.sandbox_policy
.get()
.clone(),
};
let codex_linux_sandbox_exe = self.config.codex_linux_sandbox_exe.clone();