Codex CLI Bypass Permissions: Modes and Tradeoffs
Codex approval prompts and sandbox limits are separate controls. Choose a task-scoped mode that gives the assistant the access it needs, then verify the boundary before running unattended work.
Updated 5 min read
Codex CLI can run without approval prompts, but disabling prompts and removing sandbox restrictions are different choices. The sandbox limits where commands can act; the approval policy decides when Codex pauses to ask. Start with the narrowest mode that can finish the task rather than treating every interruption as a reason for full access.
fenbs can preserve the human-approved task scope and review rules for the next connected assistant. It records what is permitted; Codex and your operating environment enforce the technical permissions.
How do you choose a mode for the task?
- Name the intended result and the exact working directory. Decide whether the assistant needs to inspect files, change files, or access an external service.
- Choose a sandbox boundary for those needs. Keep unrelated folders, credentials, and production access outside the working environment where possible.
- Choose whether actions outside that boundary may request approval or must stop without prompting.
- Check the installed CLI help and effective session status, then test a harmless allowed action and a harmless blocked action before unattended work.
OpenAI’s agent approvals and security guide (opens in a new tab) describes the separation between sandbox mode and approval policy. The useful starting question is what access the task requires. “Stop asking” describes your preferred interaction, but does not specify a safe working boundary.
Which settings remove prompts, and which expand access?
| Choice | Effect | Appropriate review question |
|---|---|---|
| read-only with on-request approvals | Keeps a read-only sandbox; actions needing additional permission can prompt. | Can the task be completed by inspection alone? |
| workspace-write with on-request approvals | Allows work inside the writable workspace; boundary crossings can prompt. | Are these the intended writable roots and network settings? |
| workspace-write with never approvals | Keeps the sandbox while removing interactive approval requests. | Will the job stop clearly if a required action is blocked? |
| dangerously-bypass-approvals-and-sandbox, also called yolo | Removes Codex command approvals and sandboxing. | Does an independently isolated environment enforce the limits instead? |
The official CLI reference (opens in a new tab) documents these flags and reserves the bypass option for externally hardened environments. It also provides --add-dir for a specific additional writable directory. Needing one output folder is a reason to assess that folder, not automatically the entire machine.
For example, a hypothetical documentation cleanup needs to edit Markdown and run a local check. It does not need a production database account. Prepare the repository and its check tools, then keep the job inside that boundary. Review the resulting changes before committing or publishing them.
What does a bounded launch look like?
For an interactive editing task, this documented combination keeps workspace writes available and allows requests when the task needs more access. Run it only in the intended project directory, then inspect the effective permissions before starting real work.
codex --sandbox workspace-write --ask-for-approval on-request
For a job that must never wait for someone to answer a prompt, you can retain that sandbox while choosing no interactive approval. Plan for the job to report a blocked requirement rather than silently changing its goal or weakening controls.
codex --sandbox workspace-write --ask-for-approval never
These examples do not configure every network or enterprise setting. Check what the session actually resolved, including writable roots and connection access. Treat an unsuccessful boundary test as a setup problem to resolve before the unattended task begins.
Keep broader command usage in the Codex CLI commands guide. If an old startup command fails, compare it with current help rather than copying an older flag combination into another machine.
Why might Codex still refuse after you change a flag?
A local preference is not necessarily the highest authority. OpenAI’s managed configuration guide (opens in a new tab) shows how administrators can restrict permitted approval policies and sandbox modes. An organization can therefore prohibit a mode that is available on an unmanaged installation.
Separate that situation from an operating-system error or a remote service refusal. Write access to the repository does not prove the same account can reach a restricted folder, push to a remote, or update a deployment. Read the actual denial and identify the system that issued it.
If a managed policy blocks the proposed mode, ask the responsible administrator for an approved task design. Often the answer is a prepared runner or a narrower input set. Renaming a command or trying to evade the policy does not establish permission for the work.
Record the approved exception or the remaining question in fenbs Decisions and rules, so the next assistant does not repeat the same permission request without knowing its answer.
What should you review before unattended execution?
Review the environment as well as the prompt. A small source change can trigger scripts, package tools, or tests with broader effects than editing the file itself. Use a disposable test environment when evaluating a new workflow, and confirm what will be preserved afterward.
- Inputs: only the files and service access needed for the task are available.
- Actions: allowed edits and checks are named, with publishing and deployment treated as separate decisions.
- Failure: a blocked dependency is reported with the next step rather than treated as a successful run.
- Review: a person inspects the changes, relevant checks, and unresolved uncertainty before accepting the result.
On a work machine, have the owner review the operating-system setup too; the Windows CLI guide covers that separate surface. The CLI best practices guide addresses the wider work loop, while CLI skills covers reusable instructions. Neither replaces a runtime permission boundary.
Keep scope clear between Codex sessions
Record the files, checks, and actions a person approved in fenbs Decisions and rules. Add unresolved access needs as tasks and save Where we left off before stopping. The next connected assistant can read the same boundary before choosing how to continue.
Create a free accountFree for one person · No credit card · Works with Claude, ChatGPT, Cursor and more
How to do this with fenbs
- Create a free account, free for one person with no credit card. Add the project and the task you want Codex to complete.
- Put the task’s goal, permitted files, required checks, and stopping conditions in its plan. Record continuing human-approved instructions in Decisions and rules.
- Connect Codex using Integrations. MCP is a standard way for an AI app to use an outside tool; ask Codex to read the project context before working.
- Choose and verify Codex permissions in the CLI or managed environment. Keep the recorded scope consistent with those enforced controls.
- Save task progress and Where we left off, including what changed, what checks ran, and any blocked action waiting on a person.
fenbs does not set Codex flags, isolate your computer, or override administrator policy. It is not the right fit when your only need is a sandbox controller. It helps when scope and review decisions must survive a new session, teammate, or supported assistant.
Begin with one bounded task and confirm the next assistant understands both the goal and its stopping point. Use the AI governance hub when you need to extend that practice across more workflows.