Learn / Securing AI coding assistants in an organisation
Lesson 3 of 69 minReviewed
Managed settings and policy across a fleet
Find the layer each coding tool reserves for administrators, deliver a baseline policy to every machine, and plan for the gaps that managed settings do not close.
Settings a developer controls are preferences. An organisation needs a layer that users and repositories cannot override, delivered to every machine and checked for drift. Most coding tools now have one, but they differ in what it can lock and how it arrives.
| Tool | Enforced layer | Delivery | Can lock, for example |
|---|---|---|---|
| Claude Code | Managed settings [1] | managed-settings.json in /Library/Application Support/ClaudeCode/, /etc/claude-code/ or C:\Program Files\ClaudeCode\; macOS profile domain com.anthropic.claudecode; HKLM\SOFTWARE\Policies\ClaudeCode; or server-managed settings from the claude.ai console [2] | Permission rules, bypass modes, MCP servers, telemetry, models |
| OpenAI Codex | requirements.toml, described as admin-enforced constraints users can't override [3] | Admin Console (Agent security), device-managed files, or an HTTPS endpoint you run [3] | Approval policies, sandbox modes or permission profiles, MCP server allowlist, deny-read paths [3] |
| GitHub Copilot | Enterprise managed-settings.json plus the "MCP servers in Copilot" policy [4] | A .github-private repository or MDM [4] | Which MCP servers run, by URL or command [4] |
| Cursor | Workspace trust setting [5] | MDM [5] | Restricted mode for new workspaces; the agent security page describes no central run-mode controls [5] |
Claude Code precedence
When a key is set in several places, Claude Code uses the highest level: managed settings, then --settings on the command line, then project local, shared project and user settings. Nothing in a user's files or --settings overrides a managed key [1]. List keys such as permissions.allow merge across files instead of replacing each other, so a user can add allow rules next to yours unless managed settings set allowManagedPermissionRulesOnly [1]. A few security keys work the other way: a stricter value from a lower level still counts, for example permissions.blockReadsOutsideWorkingDirectories: true from any scope [1].
Some keys never apply from a repository file. Claude Code ignores auto and bypassPermissions as defaultMode in project or local settings, and committed allow rules wait until each developer trusts the folder, while deny and ask rules apply at once [1]. That asymmetry is deliberate: a cloned repository can tighten a session but should not be able to loosen it.
Gaps to plan for
- Local administrators. A developer with admin rights can edit the managed source itself; Anthropic notes this is why MDM tools redeploy the file on a schedule [2].
- Defaults versus locks. A managed
modelis only a starting default; restrict choice withavailableModels[2]. - Other tools. Managed settings bind Claude Code only; a developer calling the API from another tool is not covered [2]. Each tool on your inventory needs its own policy.
- Refresh intervals. MDM and OS policies are read at startup and checked every 30 minutes; a local edit to the server-managed cache lasts only until the next fetch [2].
- Malformed policy. If a managed settings document cannot be parsed as JSON, Claude Code refuses to start [2]. On Copilot, a malformed MCP policy is treated as an empty allowlist that blocks every server except built-in defaults [4]. Stage rollouts on a pilot group.
A practical baseline for Claude Code: bypass and auto modes disabled, deny rules for credential paths and destructive commands, the sandbox on with fail-closed behaviour, an MCP allowlist, shortened cleanupPeriodDays, and telemetry exported to your collector. Confirm it landed with /status, which names the managed source in force, and claude doctor, which lists entries it dropped [2].
Try it on ThreatDeck
- Claude Code hardening generator Build a managed-settings.json baseline and review each key before deploying it.
- Playbook: secure AI coding tools Work through the organisation-wide checklist, from inventory to policy and monitoring.
- OpenAI Codex CLI sheet Check current advisories and the minimum safe version before you pin it fleet-wide.
Self-check
4 questionsPick an answer to see whether it is right and why. Only your score is saved, in this browser.
-
Managed settings sit above every other level, including
--settings. Only a short list of security keys honour a stricter value from a lower scope. -
List keys merge across scopes. To stop users broadening what the agent may run without asking, set
allowManagedPermissionRulesOnlyin managed settings. -
OpenAI separates enforced requirements from configurable defaults. Put the controls you rely on, such as allowed approval policies and the MCP allowlist, in requirements.
-
Both vendors fail closed on malformed policy. That is the safe direction, but it can stop every developer at once if a typo reaches the whole fleet.
References
- Settings files and precedence. Anthropic (Claude Code docs).
- Deploy managed settings. Anthropic (Claude Code docs).
- Managed configuration (Codex). OpenAI.
- Configuring an MCP server allowlist for your enterprise. GitHub Docs.
- Agent Security. Cursor docs.