Claude Code 2.1.314: New Security Setting for File Writes

Claude Code 2.1.314 introduces a setting that can prevent Claude from writing files outside working directories, even in bypass permissions mode.
Claude Code 2.1.314 has introduced a new security setting.
It is now possible to prevent Claude from writing files outside working directories even when bypass permissions mode is enabled.
To do this, enable the blockWritesOutsideWorkingDirectories parameter in settings.json:
{
"permissions": {
"blockWritesOutsideWorkingDirectories": true
}
}
The setting was tested with the Write and Edit tools, and writes were blocked in both cases.
However, there is an important limitation: this setting does not apply to Bash commands.
Bash can still write files outside the project.
For stronger protection, use this setting together with the sandbox in settings.json:
{
"permissions": {
"blockWritesOutsideWorkingDirectories": true
},
"sandbox": {
"enabled": true
}
}
Why it matters
AnalysisThe setting reduces the risk of accidental file changes outside a project when using AI coding tools, but it should be combined with sandboxing for stronger isolation.
Discuss in community
Share your questions and insights with developers
Related in Ecosystem
Practical guides, core terminology, and agent skills
How to Make AI Agents Safe: Stop Rules, Human Approval, and Sandboxes
An agent in production is a process that can write files, make API calls, change data, and consume tokens autonomously, without pausing and without your involvement at every step.
Agent Sandboxing
Hardware and software isolation of an autonomous agent's execution environment, ensuring the protection of the host system, secrets, and internal network from malicious code and prompt injection.
Part II. How to Work with Codex + Optimization/Security/Team
Codex is not just code autocomplete in a chat; it is a full-fledged engineering agent: it reads the repository, plans changes, edits files, runs tests, reviews its own diffs, and c...
Official Claude Code VS Code Extension Compromised
The official Claude Code extension for VS Code was compromised; for a short period, installing it could leave an SSH backdoor on a user’s computer.