Summary: Using Claude Code at work needs rules for command permissions, the sandbox, company-managed settings, MCP server approval, secrets and the data allowed in. This article describes each mechanism as the public Anthropic and GitHub documentation does, states its limits, and ends with a sample rule list a company can adopt.
Contents
- Why does Claude Code need its own rules?
- How are commands and file edits controlled?
- What does the sandbox protect, and what does it not?
- How do company-managed settings work?
- How should MCP servers be approved?
- What data and secrets may go into AI tools?
- A sample rule list a company can adopt
- When is this rule set not enough?
- FAQ
1. Why does Claude Code need its own rules?
Claude Code needs its own rules because it does more than suggest code: it reads files, runs terminal commands and edits source code with the permissions of whoever is using it. A chatbot that answers wrongly is wrong for one sentence. An agent that runs the wrong command is wrong on a real machine.
The first thing to know, per the permissions documentation: permission rules are enforced by Claude Code, not by the model. Instructions in a prompt or in a CLAUDE.md file shape what Claude tries to do, but they do not change what Claude Code allows. A line in an internal wiki saying "don't read .env" is therefore not a control. A rule only counts once it is in the configuration.
Everything below is based on the public documentation as opened on Oct 17, 2026. Features change between versions, so check the current docs before rolling anything out. The risks of unmanaged AI use by staff are covered in Shadow AI and the risks of AI-generated code.
2. How are commands and file edits controlled?
Claude Code controls actions with three kinds of rules (allow, ask, deny) plus permission modes, and a deny rule always wins. Rules are evaluated in the order deny, ask, allow, and the first match decides. A narrow allow rule cannot carve an exception out of a broad deny rule.
The modes are default (asks on first use of each tool), acceptEdits, plan (read-only exploration), auto (a background classifier reviews actions), dontAsk and bypassPermissions. The documentation says to use bypassPermissions only in isolated containers or VMs. Administrators can set permissions.disableBypassPermissionsMode and permissions.disableAutoMode to "disable", typically in managed settings so users cannot turn them back on.
For sensitive files, write deny rules such as Read(./.env) or Read(./secrets/**). Know the limit: the documentation states that Read and Edit rules apply to the built-in file tools and to file commands Claude Code recognizes in Bash, such as cat, head and sed. They do not apply to a command that reads files without naming them (like grep -r pattern .) or to a Python or Node script that opens files itself. To block every process at the OS level, the documentation points to the sandbox.
3. What does the sandbox protect, and what does it not?
The Claude Code sandbox protects shell commands and the processes they start through limits the operating system enforces, but it does not cover the file tools, local MCP servers or hooks. It is off by default; turn it on with /sandbox or sandbox.enabled: true.
| Item | Per the documentation |
|---|---|
| File writes | By default only the working directory, a temp directory and added directories |
| File reads | By default most of the machine, including ~/.ssh and ~/.aws/credentials, unless you add denyRead or credentials |
| Network | No direct route out; connections go through a proxy that allows only listed domains (empty at first) |
| Environment variables | Inherited from Claude Code, including any secrets in the environment |
| Runs outside the sandbox | Read, Edit and WebFetch tools, hooks, local MCP servers, commands typed after the ! prefix |
| Platforms | macOS, Linux, WSL2. Native Windows runs commands unsandboxed |
The last two rows are the ones policies tend to miss. A rule saying "enable the sandbox" does nothing on native Windows, where the documentation suggests running inside WSL2. Local MCP servers and hooks run outside the sandbox with the user's full access, so they need their own approval.
To enforce it through managed settings, the documentation uses three keys: sandbox.enabled, sandbox.failIfUnavailable (a missing dependency stops Claude Code from starting instead of falling back to unsandboxed execution) and sandbox.allowUnsandboxedCommands: false (no retry outside the sandbox). It also warns that allowing broad domains such as github.com can open a path for data exfiltration, because the default proxy does not inspect TLS contents.
4. How do company-managed settings work?
Managed settings have the highest precedence: no user, project or local setting, and no command-line argument, can override them, apart from a few security-sensitive exceptions. Administrators deploy them as a managed-settings.json file in a system directory, through MDM, or as server-managed settings on claude.ai.
Per the documentation, the file lives in /Library/Application Support/ClaudeCode/ on macOS, /etc/claude-code/ on Linux and WSL, and C:\Program Files\ClaudeCode\ on Windows. Some keys only work in managed settings: allowManagedPermissionRulesOnly (permission rules come only from the company), allowManagedHooksOnly and allowManagedMcpServersOnly. If something is denied at any level, no other level can allow it.
VAON uses a shared, company-managed Claude Code configuration: banned commands, sandbox, an approved list of MCP servers, and no real keys in development environments. We do not publish the actual values, because a detailed blocklist is also a map for anyone trying to get around it. What any company can do is decide in advance which settings are mandatory and which engineers may choose.
5. How should MCP servers be approved?
MCP servers should be approved through a list the administrator controls, because by default, per the documentation, anyone running Claude Code can connect any MCP server they choose. Anthropic reviews connectors before listing them in its directory but does not security-audit or manage any MCP server.
The documentation describes three patterns, from light to strict. A denylist: deniedMcpServers blocks known-bad servers. An approved catalog: allowedMcpServers together with allowManagedMcpServersOnly: true. A fixed set: a managed-mcp.json file loads only the servers the company picked, and {"mcpServers": {}} turns MCP off entirely.
When writing the list, match on serverUrl or serverCommand, not on serverName. The documentation says plainly that serverName is not a security control, since it is just a label the user assigns. A project .mcp.json triggers an approval prompt in interactive sessions, but in claude -p, Agent SDK and cloud sessions project servers load without asking. The documentation also warns that servers fetching external content raise prompt injection risk.
6. What data and secrets may go into AI tools?
Data rules must start from the account type, because training and retention policies differ between personal and commercial accounts. Per the data usage documentation, for Team, Enterprise, API and third-party platforms, Anthropic does not train generative models on code or prompts sent to Claude Code under commercial terms, unless the customer chooses to provide the data. For Free, Pro and Max, use of data for model improvement depends on the user's own setting.
On retention, the documentation lists 30 days for commercial accounts as standard; Zero Data Retention is for qualified accounts and enabled per organization. Session transcripts are also cached locally in plaintext under ~/.claude/projects/ for 30 days by default, so a secret pasted into a prompt still sits on the machine. Telemetry can be turned off with DISABLE_TELEMETRY=1, DISABLE_ERROR_REPORTING=1 or CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC. The /feedback command is different: it sends a copy of the conversation, code included, to Anthropic, and can be disabled with DISABLE_FEEDBACK_COMMAND=1.
GitHub Copilot. GitHub's content exclusion stops Copilot from using files you specify: no suggestions, no context for chat, skipped in code review. Repository admins and organization owners can configure it. Limits per the documentation itself: in VS Code it is supported in Chat but not in Edit or Agent mode; it does not apply to symbolic links or repositories on remote filesystems; and Copilot may still use semantic information the IDE supplies indirectly.
VAON's general rule for every AI tool: no customer code or data goes into an AI tool before the customer allows it, in line with the confidentiality agreement signed before the project. More in preventing information leaks in AI-assisted development.
7. A sample rule list a company can adopt
Treat this list as a template to adapt. Each rule maps to a mechanism in the documentation, so it can be checked in configuration rather than in reminders.
- Use only company-issued commercial accounts for company and customer code.
- Set
disableBypassPermissionsMode(anddisableAutoModeif not needed) in managed settings. - Turn on
allowManagedPermissionRulesOnlyso permission rules come only from the company. - Deny reads of
.env, secrets folders and key files withRead(...)rules, knowing they do not stop a script that opens files itself. - Enable the sandbox with
failIfUnavailableandallowUnsandboxedCommands: false. Windows machines run in WSL2. - Declare
sandbox.credentialsfor~/.aws,~/.sshand secret environment variables. - Allow only approved domains in the sandbox; avoid broad domains without need.
- MCP only through an approved catalog matched by URL or command, with
allowManagedMcpServersOnly. - Approve hooks and plugins too, since they run outside the sandbox; consider
allowManagedHooksOnly. - No real keys in development environments. Use separate dev keys with least privilege that can be revoked.
- No real personal data, customer data or customer code in AI tools without written permission.
- Check package names the AI suggests before installing; all AI-written code goes through a pull request and human review.
- For Copilot, configure content exclusion for sensitive files and state where it does not apply.
- Review the rules on a schedule and whenever a tool ships new features.
A minimal managed-settings example using only keys from the documentation (values are illustrative):
§json { "allowManagedPermissionRulesOnly": true, "permissions": { "disableBypassPermissionsMode": "disable", "deny": ["Read(./.env)", "Read(./secrets/**)"] }, "sandbox": { "enabled": true, "failIfUnavailable": true, "allowUnsandboxedCommands": false } } §
With failIfUnavailable, Claude Code exits at startup on native Windows. If your fleet includes such machines, deliver the configuration per operating system or move users into WSL2, as the documentation suggests.
8. When is this rule set not enough?
This configuration-based rule set has four limits, and knowing them keeps a company from trusting it too much.
- The sandbox is not a perfect boundary. The documentation itself says it reduces risk but is not complete isolation.
- Permission rules do not replace a human reader. The security documentation says users are responsible for reviewing code and commands before approving them.
- Configuration does not reach personal devices. AI tools on a personal machine sit outside any managed setting.
- The documentation changes. Key names and defaults shift between versions; recheck the sample before using it.
A small team trying Claude Code for a few days on non-sensitive code may not need managed settings yet. Once customer code or real data appears, put the configuration in place before habits form.
9. FAQ
Is writing rules in CLAUDE.md enough to control Claude Code?
No. Per the permissions documentation, instructions in prompts and CLAUDE.md shape what Claude tries to do but do not change what Claude Code allows. To enforce, use permission rules, the sandbox or managed settings.
If the sandbox is on, are permission rules still needed? Yes. The documentation treats the two as complementary layers. The sandbox covers shell commands only; the file tools, local MCP servers and hooks run outside it and need permission rules and their own approval.
Can Claude Code be used on customer code? Only if the customer has allowed it. Ask at the confidentiality agreement stage, and record the account type and where data goes. When the customer has not allowed it, VAON does not put the code into AI tools.
Can staff use personal Pro or Max plans for company work? They should not. Personal-account data policy depends on each person's own settings, which the company cannot manage. Use company-issued commercial accounts.
Drafting AI coding rules for your engineers or partners? VAON shares how we run our own process in a 60-minute session with the CEO. No documents needed, no obligation. Book a free 60-minute consultation
See also: 12 things to confirm before outsourcing AI-driven development and AI coding security guidance for software vendors from the Japanese government.
References (opened Oct 17, 2026)
- Claude Code, Configure permissions: https://code.claude.com/docs/en/permissions
- Claude Code, Configure the sandboxed Bash tool: https://code.claude.com/docs/en/sandboxing
- Claude Code, Control MCP server access for your organization: https://code.claude.com/docs/en/managed-mcp
- Claude Code, Data usage: https://code.claude.com/docs/en/data-usage
- GitHub Docs, Content exclusion for GitHub Copilot: https://docs.github.com/en/copilot/concepts/context/content-exclusion