ES · Leer en español Explore for free

News ·

Claude Code 2.1.314: block writes outside your project

New blockWritesOutsideWorkingDirectories setting: Write, Edit and NotebookEdit refuse files outside your working directories, in every mode.

Claude Code 2.1.314 · Source: github.com

What changes

Claude Code 2.1.314 adds the permissions.blockWritesOutsideWorkingDirectories setting. When it is on, the Write, Edit and NotebookEdit tools refuse paths outside the working directories, in every permission mode.

Until now, a permission rule or a permissive mode could let Claude edit files outside the project (your ~/.bashrc, another repository, global configuration). With this setting, the folder sets the boundary, no matter what you have approved.

How to use it

1. Turn the setting on

In the project's .claude/settings.json (or in ~/.claude/settings.json for all your projects):

{
  "permissions": {
    "blockWritesOutsideWorkingDirectories": true
  }
}

2. Check it

Ask Claude to create a file outside the project folder. The write fails with a message like this:

/tmp/fuera.txt is outside /home/you/project; the permissions.blockWritesOutsideWorkingDirectories setting blocks writes outside the working directories. Ask the user to add the directory with /add-dir, or to remove that setting.

Inside the project folder nothing changes.

3. If you need another folder

Add it as a working directory with /add-dir <path> and Claude can write there.

Tested with 2.1.316: with an Edit(//tmp/…/**) rule that allows the write, the file is created; with the same rule and the setting on, Write refuses it with the message above, and files inside the project are still created.

Does it affect you?

All news