Claude Code & Codex: Locking security settings so developers can't override them
Key takeaways
- Deploy managed settings that sit above user, project and local config, then disable the bypass paths explicitly.
- In Claude Code, set
permissions.disableBypassPermissionsMode,allowManagedPermissionRulesOnlyandallowManagedHooksOnlyin managed-settings.json. - In Codex, put limits in admin-enforced requirements.toml, not config.toml, and restrict who can answer approvals.
- Prove it with adversarial tests on a real laptop, and repeat them after every agent update.
Why permission prompts get overridden in real teams
Developers override prompts because prompts cost them time, and anything writable on their machine can be changed unless an admin-managed layer sits above it. The goal isn't more prompts. It's making the weaker option unavailable.
Anthropic's own data shows the pull. In its auto mode announcement, it reported that as of June 2026, 49.5% of active Claude CLI users had created a Bash allow-rule. Another 62% had used bypassPermissions or clicked "don't ask again" on Bash, and 25% of interactive sessions started in bypass permissions mode.
The threat model is ordinary: edited local config, CLI flags, project settings committed to a repo, and approvals routed to an automated reviewer.
How do Claude Code managed settings stop overrides?
Managed settings are a policy file that your device management tool installs and that outranks user, project and local settings. Developers can't weaken a key that the managed layer sets.
Deploy managed-settings.json through Intune, Kandji or your equivalent. The file path differs by OS, so take it from Anthropic's managed settings documentation. A minimum safe policy looks like this:
{
"permissions": {
"disableBypassPermissionsMode": "disable"
},
"allowManagedPermissionRulesOnly": true,
"allowManagedHooksOnly": true
}
Each key closes a specific hole:
disableBypassPermissionsModeremoves bypass mode, including the--dangerously-skip-permissionsroute.allowManagedPermissionRulesOnlyignores allow rules developers add locally, such asBash(python:*), which is effectively arbitrary code execution.allowManagedHooksOnlystops local or project hooks from running, so nobody can swap in a hook that approves everything.
Verify on a real machine. Run /status inside a session to see which settings sources are active, and run claude doctor for diagnostics. If the managed source isn't listed, the policy isn't in force.
How do you lock Codex with requirements.toml?
Codex's config.toml is a preference file that users edit. requirements.toml is the admin-enforced file that sets what config is allowed to choose. Only the second blocks overrides.
Use it to constrain allowed_approval_policies and allowed_sandbox_modes, then constrain who answers escalations with allowed_approvals_reviewers. That last key matters. Running codex --approve-for-me, or setting approvals_reviewer = "auto_review", sends permission prompts to Codex's auto-reviewer instead of a person. Auto-review is a capable control, but if your policy says a human must approve, set allowed_approvals_reviewers = ["user"] in managed requirements. Check Codex's admin documentation for current key names and file locations before rollout.
Confirm by trying it: set a disallowed approval_policy in your own config.toml and check that Codex rejects it or falls back to an allowed value.
Which override attempt does which control block?
| Override attempt | Claude Code control | Codex control |
|---|---|---|
| Switch to bypass or skip mode | disableBypassPermissionsMode | allowed_approval_policies, allowed_sandbox_modes |
| Add a broad allow rule | allowManagedPermissionRulesOnly | Sandbox limits in requirements.toml |
| Add or change a hook | allowManagedHooksOnly | Runtime layer outside the agent |
| Route approvals to an auto-reviewer | Not applicable | allowed_approvals_reviewers |
Where do built-in controls stop, and what does a runtime layer add?
Built-in controls decide what the agent is configured to do. They don't independently judge what it actually does, and each agent has its own settings format. A separate runtime layer covers both gaps.
Watcher, built by Apollo Research, treats the coding agent as untrusted and wraps its tool calls. It runs through the agent's hooks, with built-in connections for Claude Code, Codex and GitHub Copilot CLI. Blocking review checks a tool call before it runs and allows, denies or escalates it to a person. Trailing review grades the whole session to catch patterns a single call doesn't show.
The anti-override part is locking. In Watcher's organization settings, individual values can be locked so a developer's local settings can't change them back, and active_profile can be locked to pin every machine to one profile. The managed settings demo shows the resolved policy document.
Know one edge case. A Codex session can run under an approval policy that asks about nothing. Watcher then receives no requests, so in enforce mode it reviews none of that session's calls before they run. That's why the Codex requirements above come first: constrain the approval policy natively, then enforce on top of it.
How do you roll this out without slowing engineers?
Start in observe-only mode, tighten, then enforce. Teams usually switch on blocking once they trust what is flagged.
- Push managed-settings.json and requirements.toml to a pilot group through MDM.
- Run Watcher observe-only and review flagged sessions in Analyzer.
- Tune rules, then switch to enforce for high-risk actions such as destructive infrastructure changes.
- Define an exception process with an expiry date, so troubleshooting doesn't permanently widen policy.
- Send findings to your SIEM through the Watcher Python SDK and API. Example exporters cover Google Security Operations, Microsoft Sentinel, Splunk HEC and OpenTelemetry.
Self-hosting is available if session data must stay on your infrastructure.
How do you prove developers can't override anything?
Run an adversarial checklist on a normal developer machine, with no admin rights:
- Launch with a bypass flag and confirm it's refused.
- Add
Bash(python:*)to local and project settings and confirm it's ignored. - Add a permissive local hook and confirm it doesn't run.
- Try
--approve-for-mein Codex and confirm escalations still reach a human. - Edit a locked Watcher value locally and confirm the managed value wins.
Rerun the list after every Claude Code or Codex update, since precedence behavior can change between versions. In Analyzer, look for denial reasons, escalations and final graded outcomes.
FAQ
Which Claude Code permission modes should enterprises disable?
Disable bypass permissions mode, which skips permission checks entirely. Plan, default and auto modes still apply checks, though in auto mode broad allow rules such as python:* skip the classifier, so pair it with allowManagedPermissionRulesOnly.
Does it matter if developers can edit local files?
Yes, unless a managed layer outranks those files. Local and project settings are the easiest place to widen access, so the policy has to live above them.
Is "Approve for me" safe?
It depends on your policy. It routes escalations to Codex's auto-reviewer instead of a person, so if you require human approval, restrict it with allowed_approvals_reviewers = ["user"] and test that it holds.
If you want to see how your agents behave before locking anything down, Apollo Research offers a free agent security audit of your Claude Code and Codex sessions.
See one locked policy across Claude Code, Codex and Copilot CLI
Book a call and we'll show you how Watcher's locked settings keep every machine on one policy, starting in observe-only mode.