mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Honor per-environment permission profiles (#38673)
## What changed - Add a resolved `permission_profile` to each `EnvironmentConfig` and use the complete attachment config for execution and capability-root selection. - Let `Ready` environment configurations override thread permissions while `FromThread` selections continue to inherit them. - Restrict inherited Guardian environment profiles to read-only permissions. ## Testing - Add coverage proving that a read-only environment blocks writes even when the thread permits workspace writes. - Update environment inheritance, Guardian review, and capability-root tests for the resolved attachment configuration. GitOrigin-RevId: 1a313b9e4892b1a579a0e880e322a782b4f6c0a7
This commit is contained in:
1 parent
15fde8c1f2
commit
1873e947f8
17 files changed
+245
-145
No files matched your search
@@ -14,7 +14,6 @@ use crate::sandboxing::SandboxPermissions;
|
||||
use crate::session::step_context::StepContext;
|
||||
use crate::session::tests::make_session_and_context;
|
||||
use crate::session::turn_context::TurnEnvironment;
|
||||
use crate::session::turn_context::TurnEnvironmentConfig;
|
||||
use crate::shell::Shell;
|
||||
use crate::shell::ShellType;
|
||||
use crate::tools::context::FunctionToolOutput;
|
||||
@@ -25,6 +24,7 @@ use crate::tools::handlers::ShellCommandHandler;
|
||||
use crate::tools::hook_names::HookToolName;
|
||||
use crate::tools::registry::CoreToolRuntime;
|
||||
use crate::turn_diff_tracker::TurnDiffTracker;
|
||||
use codex_protocol::protocol::EnvironmentConfig;
|
||||
use codex_protocol::protocol::EnvironmentConfigState;
|
||||
use codex_protocol::protocol::TurnEnvironmentSelection;
|
||||
use codex_shell_command::is_safe_command::is_known_safe_command;
|
||||
@@ -119,13 +119,13 @@ async fn shell_command_handler_to_exec_params_uses_selected_environment() {
|
||||
.environment,
|
||||
),
|
||||
Some(selected_shell),
|
||||
TurnEnvironmentConfig {
|
||||
EnvironmentConfig {
|
||||
allow_login_shell: true,
|
||||
permission_profile: PermissionProfileSnapshot::active(
|
||||
permission_profile,
|
||||
active_permission_profile.clone(),
|
||||
),
|
||||
selected_capability_roots: None,
|
||||
selected_capability_roots: Vec::new(),
|
||||
},
|
||||
);
|
||||
let mut expected_env = create_env(
|
||||
|
||||
Reference in new issue
Block a user