Skip to content

Commit 0e827b6

Browse files
Sing303bolinfest
andauthored
Auto-approve DangerFullAccess patches on non-sandboxed platforms (#2988)
**What?** Auto-approve patches when `SandboxPolicy::DangerFullAccess` is enabled on platforms without sandbox support. Changes in `codex-rs/core/src/safety.rs`: return `SafetyCheck::AutoApprove { sandbox_type: SandboxType::None }` when no sandbox is available and DangerFullAccess is set. **Why?** On platforms lacking sandbox support, requiring explicit user approval despite `DangerFullAccess` being explicitly enabled adds friction without additional safety. This aligns behavior with the stated policy intent. **How?** Extend `assess_patch_safety` match: * If `get_platform_sandbox()` returns `Some`, keep `AutoApprove { sandbox_type }`. * If `None` **and** `SandboxPolicy::DangerFullAccess`, return `AutoApprove { SandboxType::None }`. * Otherwise, fall back to `AskUser`. **Tests** * Local checks: ```bash cargo test && cargo clippy --tests && cargo fmt -- --config imports_granularity=Item ``` (Additionally: `just fmt`, `just fix -p codex-core`, `cargo check -p codex-core`.) **Docs** No user-facing CLI changes. No README/help updates needed. **Risk/Impact** Reduces prompts on non-sandboxed platforms when DangerFullAccess is explicitly chosen; consistent with policy semantics. --------- Co-authored-by: Michael Bolin <[email protected]>
1 parent daaadfb commit 0e827b6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

codex-rs/core/src/safety.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ pub fn assess_patch_safety(
5353
// paths outside the project.
5454
match get_platform_sandbox() {
5555
Some(sandbox_type) => SafetyCheck::AutoApprove { sandbox_type },
56+
None if sandbox_policy == &SandboxPolicy::DangerFullAccess => {
57+
// If the user has explicitly requested DangerFullAccess, then
58+
// we can auto-approve even without a sandbox.
59+
SafetyCheck::AutoApprove {
60+
sandbox_type: SandboxType::None,
61+
}
62+
}
5663
None => SafetyCheck::AskUser,
5764
}
5865
} else if policy == AskForApproval::Never {

0 commit comments

Comments
 (0)