AI hardening kit · Claude Code
Claude Code managed settings
Pick a preset, adjust the controls, copy the file. Every key links to the Claude Code doc it was checked against; options we could not verify are left out. Output is valid JSON for managed-settings.json, an MDM profile or the claude.ai admin console, with the minimum version set to 2.1.273 (the higher of the Advisory Board's minimum safe version and 2.1.273, required by the managed MCP allowlist).
What each enabled control does
Not in this file (managed settings only)
Building an MCP allowlist with pinned versions and advisory checks? Use the MCP allowlist generator and paste its entries into Allowed MCP servers.
Where to put the file
Save as managed-settings.json in the system directory, using whatever already places files on your fleet:
- macOS:
/Library/Application Support/ClaudeCode/managed-settings.json - Linux and WSL:
/etc/claude-code/managed-settings.json - Windows:
C:\Program Files\ClaudeCode\managed-settings.json(the legacyC:\ProgramData\ClaudeCode\path is not read) - MDM: a macOS configuration profile for the
com.anthropic.claudecodepreference domain, or the JSON as aREG_SZvalue namedSettingsunderHKLM\SOFTWARE\Policies\ClaudeCode(Intune, Group Policy). Starter templates: anthropics/claude-code examples/mdm. - Server-managed: paste the same JSON in the claude.ai admin console (fetched at startup and hourly). Put
forceLoginOrgUUID/forceLoginMethodin the file or MDM policy. - Several teams? Split it into
managed-settings.d/10-*.jsondrop-ins next to the file; lists merge, later single values win.
Check one machine before the fleet: /status in Claude Code shows Enterprise managed settings (file) on the Setting sources line, and claude doctor lists any entry it dropped. A file that is not valid JSON stops Claude Code from starting. Deploy managed settings
Save as ~/.claude/settings.json: it applies to every project on this machine, for you only. Managed-only keys (the locks) are left out because Claude Code ignores them here. Settings files
Save as .claude/settings.json at the top of the repository and commit it. Deny and ask rules apply in every session; allow rules wait until each person trusts the folder. defaultMode values auto and bypassPermissions do not take effect from a project file. Example settings files
Hooks
Hooks are your own scripts, so this page does not write them. A PreToolUse hook on Bash that exits with code 2 blocks the tool call, with its stderr as the reason. Deploy vetted hooks in managed settings and set Only managed hooks run (allowManagedHooksOnly) so user, project and plugin hooks cannot run; a ConfigChange hook can audit or block settings changes during sessions. Hooks reference
{
"hooks": {
"PreToolUse": [
{ "matcher": "Bash", "hooks": [{ "type": "command", "command": "/usr/local/bin/your-bash-guard.sh" }] }
]
}
} What this does not protect
- Read deny rules cover Claude's file tools and file commands it recognises (cat, head, sed…), not a command that reads files without naming them (grep -r over a folder) or a script that opens files itself. Turn on the sandbox for OS-level enforcement. source
- Bash rules match the command as Claude writes it: Bash(curl *) does not stop /usr/bin/curl or sh -c 'curl …'. source
- The sandbox wraps shell commands only. Read, Edit, WebFetch and WebSearch follow permission rules; hooks, local MCP servers, plugin monitors and helper commands run with the developer's full access. source
- Commands a developer types at the ! prompt usually run unsandboxed, with the access they already have in any terminal. source
- The sandbox proxy decides on the hostname without inspecting TLS: broad domains such as github.com can still carry data out. source
- The sandbox does not run on native Windows; with failIfUnavailable those machines cannot start Claude Code. source
- A developer with local admin rights can edit the managed file; redeploy it on a schedule from MDM. Managed settings bind Claude Code only, not other tools that call the API. source
- Sessions in Anthropic-hosted cloud environments do not read a device's file or MDM profile: use server-managed settings for them. source
- An MCP allowlist decides which servers load, not what an allowed server does with its tools or the data it returns. Review servers before you allow them. source
Sources (checked 2026-11-10): Settings reference · Settings files and precedence · Deploy managed settings · Configure permissions · Sandboxing · Managed MCP configuration · Environment variables · Hooks · Security. Some keys need a recent Claude Code; /status and claude doctor show what a machine applied.