Expand description
Opt-in access to the flags that disable codex’s safety controls.
--dangerously-bypass-approvals-and-sandbox turns off every approval
prompt and the sandbox. --dangerously-bypass-hook-trust lets configured
hooks run without confirmation. Both were plain builder methods, reachable
from any chain by autocomplete, by a copied snippet, or by an agent editing
a call site. A method name is not a barrier.
They now need two things that cannot both happen by accident:
- A
DangerousClient, which only constructs whenCODEX_WRAPPER_ALLOW_DANGEROUSis set in the process environment. - A call through
Dangerous, passing that client, which re-checks the variable at the point of use.
The second check is not redundant. A client built while the variable was set stops working the moment it is unset, so the gate reflects the environment at the moment the bypass is applied rather than whenever the client happened to be created.
The name matches the sibling crate’s CLAUDE_WRAPPER_ALLOW_DANGEROUS.
§Example
use codex_wrapper::{ExecCommand, dangerous::{Dangerous, DangerousClient}};
// Without the environment variable, there is no way through.
assert!(DangerousClient::new().is_err());use codex_wrapper::{CodexCommand, ExecCommand};
use codex_wrapper::dangerous::{Dangerous, DangerousClient};
// With CODEX_WRAPPER_ALLOW_DANGEROUS set in the environment:
let allow = DangerousClient::new()?;
let output = ExecCommand::new("rewrite everything")
.bypass_approvals_and_sandbox(&allow)?
.execute(codex)
.await?;Structs§
- Dangerous
Client - Proof that bypassing codex’s safety controls is permitted here.
Constants§
- ALLOW_
DANGEROUS_ ENV - The environment variable that unlocks the bypass flags.
Traits§
- Dangerous
- Bypassing codex’s safety controls, for the builders that support it.