mirror of
https://github.com/openai/codex.git
synced 2026-12-03 07:47:10 +00:00
Honor per-environment shell variable policies (#38902)
## What changed - Carry `ShellEnvironmentPolicy` in each resolved `EnvironmentConfig` and use the selected turn environment's policy for shell commands, user shell tasks, and unified exec. - Infer the policy from the thread configuration when an environment does not provide its own resolved configuration. - Redact the policy from `EnvironmentConfig` debug output because it can contain explicit environment variable values. ## Testing - Verify shell handlers and unified exec filter inherited variables according to the selected environment while preserving its explicit overrides. GitOrigin-RevId: 9f6a52aa4af60e5f17251a0e1b11e1926b779055
This commit is contained in:
1 parent
f85e81d30b
commit
6c108912ee
22 files changed
+219
-52
No files matched your search
@@ -786,6 +786,7 @@ mod tests {
|
||||
EnvironmentConfig {
|
||||
allow_login_shell: true,
|
||||
permission_profile: PermissionProfileSnapshot::legacy(PermissionProfile::read_only()),
|
||||
shell_environment_policy: Default::default(),
|
||||
selected_capability_roots: Vec::new(),
|
||||
}
|
||||
}
|
||||
@@ -957,6 +958,7 @@ url = "ws://127.0.0.1:8765"
|
||||
ActivePermissionProfile::read_only(),
|
||||
vec![cwd.join("profile-root")],
|
||||
),
|
||||
shell_environment_policy: Default::default(),
|
||||
selected_capability_roots: Vec::new(),
|
||||
};
|
||||
let turn_environments = ThreadEnvironments::new(
|
||||
@@ -1158,6 +1160,7 @@ url = "ws://127.0.0.1:8765"
|
||||
ActivePermissionProfile::read_only(),
|
||||
vec![cwd.join("profile-root")],
|
||||
),
|
||||
shell_environment_policy: Default::default(),
|
||||
selected_capability_roots: Vec::new(),
|
||||
};
|
||||
let cwd = PathUri::from_abs_path(&cwd);
|
||||
@@ -1491,6 +1494,7 @@ url = "ws://127.0.0.1:8765"
|
||||
ActivePermissionProfile::read_only(),
|
||||
vec![cwd.join("child-profile-root")],
|
||||
),
|
||||
shell_environment_policy: Default::default(),
|
||||
selected_capability_roots: Vec::new(),
|
||||
};
|
||||
let environments = ThreadEnvironments::new(
|
||||
@@ -1534,6 +1538,7 @@ url = "ws://127.0.0.1:8765"
|
||||
let parent_owner_config = EnvironmentConfig {
|
||||
allow_login_shell: false,
|
||||
permission_profile: PermissionProfileSnapshot::legacy(PermissionProfile::read_only()),
|
||||
shell_environment_policy: Default::default(),
|
||||
selected_capability_roots: vec![root("parent-root")],
|
||||
};
|
||||
let mut owner_selection = selection.clone();
|
||||
|
||||
Reference in new issue
Block a user