サンドボックスは、エージェントを実際に「フェンスの内側」に留めておくことができて初めて意味を成します。Claude Code 2.1.216では、バックグラウンドタスク、サブエージェント、または再開されたセッションが、割り当てられたディレクトリの外へ逸脱してしまう可能性のあるいくつかの隙間を塞いでいます。このリリースでは新しい設定スイッチが導入されましたが、より重要な変更は内部で行われています。それは、Git worktree、シンボリックリンク、およびエージェントの再起動に対する、よりスマートな処理です。Claude CodeをローカルまたはCIで実行している場合、これらの変更は単にチェンジログを流し読みする以上の注意を払う価値があります。

安易に設定を変更すべきではないファイルシステムの切り替えスイッチ

バージョン2.1.216では、sandbox.filesystem.disabledが追加されました。これが設定されている場合、Claude Codeはネットワークサンドボックスは適用しつつも、独自のファイルシステム隔離をスキップします。一見すると、これは権限エラーを回避したり、ファイル操作を高速化したりするための方法のように聞こえるかもしれません。しかし、そうではありません。この設定を有効にしてよいのは、別のレイヤーですでにディスクが保護されている場合に限られます。

つまり、実行のたびに削除される使い捨てのコンテナや、ホームディレクトリやプロダクションボリュームへのアクセス権を持たない専用の仮想マシンを使用している場合です。macOS、Windows、またはベアメタルなLinuxホスト上でClaude Codeを直接実行している場合は、ファイルシステムの隔離をオンにしたままにしてください。ネットワークサンドボックスはファイルシステム制御の代わりにはなりません。サンドボックス化されたファイルアクセスによるわずかな摩擦は、誤った上書きや、プロジェクトフォルダを突破する悪意のあるプロンプトインジェクションから復旧するコストに比べれば、はるかに安上がりです。

この切り替えスイッチは、パフォーマンスを調整するためのノブではなく、互換性を確保するためのシム(shim)として考えてください。これは、オペレーティングシステムやオーケストレーターがすでに隔離を処理しており、Claude独自のサンドボックスが不要な複雑さを加えるような環境のために存在しています。

このアップデートが実際に修正するもの

新しい設定以外にも、2.1.216ではエージェントが本来アクセスすべきでない場所に到達できてしまう、いくつかの実用的な穴を塞いでいます。

Worktreeの隔離。 サブエージェントが、自身のworktreeの外にある親ディレクトリや兄弟ディレクトリにGitコマンドをリダイレクトすることができなくなりました。以前は、プロジェクト内で実行されているサブエージェントが、共有のチェックアウトディレクトリや隣接するリポジトリに対してGit操作を行うことが可能でした。多くの開発者が共通の親フォルダの下に複数のプロジェクトを保持しているため、これは重要な問題です。今後は、こうした境界を越えるコマンドは失敗します。

.claudeパスにおけるシンボリックリンクの強化。 これまで、ワークフロー定義やスケジュールされたタスクは、設定を書き込む際にシンボリックリンクを辿ることがありました。例えば、.claudeからシェルのプロファイルやSSHディレクトリへとシンボリックリンクを作成できる攻撃者がいた場合、エージェントにプロジェクト外へ書き込みを行わせる可能性があります。今回のアップデートでは、そのパスでのシンボリックリンクの追跡を拒否することで、この問題を解決しています。

より安全なリワインド。 最近の変更をロールバックできる/rewindコマンドは、シンボリックリンクやハードリンクされたパスをスキップするようになりました。このガードがなければ、リワインド操作がシンボリックリンクを追いかけ、リポジトリから遠く離れたファイルを上書きしてしまう恐れがありました。Claudeは現在、これらのスキップされたパスを明示的に報告するため、境界が維持されていることを確認できます。

再開されたエージェントの制限を維持。 一度停止して後に再開されたバックグラウンドセッションが、デフォルトのツール権限にフォールバックしてしまう問題がありました。エージェントに対して「読み取りはできるが書き込みはできない」といった制限を意図的に設けていた場合、再起動によって気づかないうちに広範なアクセス権が復元されてしまうことがありました。現在は、元の制限がセッションと共に保持され、復元されます。

セキュリティプロファイルの選択

Claude Code 2.1.216では、これらの制御を3つのプロファイルに整理しています。「どちらが速そうか」ではなく、「ツールをどこで実行するか」に基づいて選択してください。

Default. ファイルシステムとネットワークの両方のサンドボックスが有効になります。これは、ノートPCやワークステーションでのローカル開発に適した選択です。コンテナを管理することなく、ホームディレクトリ、システムファイル、および隣接するプロジェクトを保護します。

Compatibility. ファイルシステムの隔離はオフになりますが、ネットワークサンドボックスは維持されます。このプロファイルは、ファイルシステムがすでにエフェメラル(一時的)であるか、厳格にスコープされている使い捨てのコンテナやVMに限定して使用してください。エージェントに保護されたフォルダへのアクセスを許可するためにパスワードを入力するのが面倒だからという理由で使用しないでください。

Managed Hard Gate. 両方のサンドボックスレイヤーが有効であり、オーケストレーターやセキュリティチームによって強制される追加のコンテナポリシーを前提としたプロファイルです。これは、多層防御が必須となるCIパイプライン、リモート開発環境、およびエンタープライズ環境向けに構築されています。

どれが適しているか不明な場合は、Defaultから始めてください。実行環境がそれ自体でファイルシステムを確実に隔離していることを確認した後にのみ、保護レベルを下げることを検討してください。

ワークフローを壊さずにアップグレードする

Do not treat this as a routine patch you install on a Friday afternoon. The upgrade path in 2.1.216 is straightforward, but the consequences of misconfiguration are not.

First, upgrade to 2.1.216 through your normal package manager or installer. Then pick one of the three isolation profiles before starting any agent tasks. Do not mix profiles across running sessions without understanding which one takes precedence.

Next, run the five non-destructive boundary tests described below. These are quick, scripted checks that prove the sandbox behaves the way the profile promises. During testing, generate sentinel hashes for files outside your disposable test repository. A sentinel hash is simply a checksum of a sensitive file or directory you want to protect. After running the tests, compare the hashes. If anything changed, your isolation is leaking.

Compare your logs as well. Claude Code writes denials and sandbox events to its local logs. Look for explicit rejections when a blocked host is reached or when a subagent steps out of its worktree. Silent failures are worse than loud ones, so verify that the logs show the guardrails kicking in.

Finally, roll the change out gradually. Start with a single project or a non-production branch. Let the new version run for a day or two before you deploy it across your entire team or CI fleet.

Five Boundary Tests That Prove Your Sandbox Works

Always run these tests inside a disposable repository stuffed with fake data. Never point them at production code, real credentials, or live infrastructure.

Network boundary. Attempt to reach two endpoints: one you have explicitly allowed and one you have blocked. A simple HTTP request against a public test service like httpbin.org can serve as the allowed target, while a request to a local metadata endpoint or an internal IP should fail. If the blocked request succeeds, your network sandbox is misconfigured.

Worktree isolation. From inside a subagent, run a Git command aimed at the parent directory. For example, try git -C .. status or have the agent describe files outside its checkout. With the fix in 2.1.216, this must fail. The subagent should see only its own worktree.

Symlink trap. Create a symlink inside your project that points to a directory outside the repository, such as /tmp/sentinel-target. Then try to save a task or workflow under the .claude path that would write through that link. After the save, check the outside directory. If it is still empty, the symlink hardening is working.

Rewind skip. Set up a folder inside your repo that contains a symlink to a system file or another directory. Run /rewind on that folder. Claude should list the skipped symlinked or hard-linked paths rather than chasing them. Confirm that the target outside the repo remains untouched.

Session resurrection. Launch a background agent with a strict restriction, such as disabling file-write tools. Pause or stop the session, then resume it. Immediately try to make the agent write a file. If the restriction is still active, the fix for resumed agents is working. If the agent suddenly has full tool access again, you are still exposed.

Final Word

Claude Code 2.1.216 gives you more flexibility than previous versions, but that flexibility comes with a clear mandate: verify before you trust. The new filesystem toggle is not there to make your life easier at the expense of safety. It is there for engineers who already built a hardened floor underneath the tool. The real improvements in this release are the silent guardrails that stop subagents from creeping into parent directories, that refuse to follow symlinks during configuration writes, and that remember the rules even after a long pause.

Run the five tests. Check your sentinel hashes. Read the logs. Then, and only then, let the new version handle real work.

Source: Claude Code v2.1.216 Release Notes

Optional learning community: GyaanSetu on Telegram