A sandbox is only useful if it actually keeps the agent inside the fence. Claude Code 2.1.216 tightens several gaps that could let a background task, subagent, or resumed session wander outside its assigned directory. This release introduces a new configuration switch, but the more important work is under the hood: smarter handling of Git worktrees, symlinks, and agent restarts. If you run Claude Code locally or in CI, these changes deserve more than a quick skim of the changelog.

The Filesystem Toggle You Should Not Touch Lightly

Version 2.1.216 adds sandbox.filesystem.disabled. When this is set, Claude Code skips its own filesystem isolation while still enforcing the network sandbox. At first glance this sounds like a way to stop permission errors or speed up file operations. It is not. You should only enable this setting if another layer is already protecting your disk.

That means a disposable container that gets deleted after every run, or a dedicated virtual machine with no access to your home directory or production volumes. If you run Claude Code directly on macOS, Windows, or a bare Linux host, leave filesystem isolation on. The network sandbox is not a substitute for filesystem controls, and the minor friction of sandboxed file access is far cheaper than recovering from an accidental overwrite or a malicious prompt injection that breaks out of the project folder.

Think of the toggle as a compatibility shim, not a performance knob. It exists for environments where the operating system or orchestrator already handles isolation, and Claude’s own sandbox adds unnecessary complexity.

What the Update Actually Fixes

Beyond the new setting, 2.1.216 closes several practical holes that could let an agent reach places it should not.

Worktree isolation. Subagents can no longer redirect Git commands into a parent or sibling directory outside their own worktree. Previously, a subagent running inside your project could aim Git operations at your shared checkout or adjacent repositories. That matters because many developers keep multiple projects under a common parent folder. Now those boundary-crossing commands fail.

Symlink hardening at the .claude path. Workflow definitions and scheduled tasks used to follow symlinks when writing configuration. An attacker who could create a symlink from .claude to, say, your shell profile or SSH directory could potentially get the agent to write outside the project. The update stops this by refusing to follow symlinks at that path.

Safer rewinds. The /rewind command, which lets you roll back recent changes, now skips symlinked and hard-linked paths. Without this guard, a rewind operation could chase a symlink and overwrite a file far away from your repository. Claude now reports those skipped paths explicitly so you know the boundary held.

Resumed agents keep their restrictions. Background sessions that get stopped and later resumed used to fall back to default tool permissions. If you had intentionally restricted an agent so it could read but not write, a restart could silently restore broader access. Now the original restrictions are persisted and restored with the session.

Picking a Security Profile

Claude Code 2.1.216 organizes these controls into three profiles. Choose based on where you run the tool, not based on what feels fastest.

Default. Filesystem and network sandboxing both stay active. This is the right choice for local development on your laptop or workstation. It protects your home directory, system files, and neighboring projects without requiring you to manage containers.

Compatibility. Filesystem isolation is turned off, but the network sandbox remains. Restrict this profile to disposable containers or VMs where the filesystem is already ephemeral or strictly scoped. Do not use it because you are tired of typing passwords to let the agent access a protected folder.

Managed Hard Gate. Both sandbox layers stay on, and the profile expects additional container policies enforced by your orchestrator or security team. This is built for CI pipelines, remote dev environments, and enterprise setups where defense in depth is mandatory.

If you are unsure which one fits, start with Default. You can downgrade the protection later only after you have verified that your runtime environment genuinely isolates the filesystem by itself.

Upgrading Without Breaking Your Workflow

Jangan anggap ini sebagai tampalan rutin yang anda pasang pada petang Jumaat. Laluan naik taraf dalam 2.1.216 adalah mudah, tetapi kesan salah konfigurasi bukanlah mudah.

Pertama, naik taraf ke 2.1.216 melalui pengurus pakej atau pemasang biasa anda. Kemudian, pilih salah satu daripada tiga profil pengasingan sebelum memulakan sebarang tugas ejen. Jangan campurkan profil merentasi sesi yang sedang berjalan tanpa memahami profil mana yang mempunyai keutamaan.

Seterusnya, jalankan lima ujian sempadan tanpa pemusnahan (non-destructive) yang diterangkan di bawah. Ini adalah semakan skrip pantas yang membuktikan sandbox berkelakuan seperti yang dijanjikan oleh profil tersebut. Semasa pengujian, jana hash sentinel untuk fail di luar repositori ujian boleh buang anda. Hash sentinel hanyalah checksum bagi fail atau direktori sensitif yang ingin anda lindungi. Selepas menjalankan ujian, bandingkan hash tersebut. Jika ada apa-apa yang berubah, pengasingan anda sedang bocor.

Bandingkan log anda juga. Claude Code menulis penafian dan peristiwa sandbox ke dalam log tempatannya. Cari penolakan eksplisit apabila hos yang disekat dicapai atau apabila subejen keluar dari worktree miliknya. Kegagalan senyap adalah lebih buruk daripada kegagalan yang jelas, jadi sahkan bahawa guardrail sedang berfungsi.

Akhir sekali, laksanakan perubahan secara berperingkat. Mulakan dengan satu projek atau cawangan (branch) bukan pengeluaran. Biarkan versi baharu berjalan selama satu atau dua hari sebelum anda melancarkannya ke seluruh pasukan atau armada CI anda.

Lima Ujian Sempadan yang Membuktikan Sandbox Anda Berfungsi

Sentiasa jalankan ujian ini di dalam repositori boleh buang yang dipenuhi dengan data palsu. Jangan sesekali tujukan ujian ini kepada kod pengeluaran, kredensial sebenar, atau infrastruktur langsung.

Sempadan rangkaian. Cuba capai dua titik akhir (endpoint): satu yang anda telah benarkan secara eksplisit dan satu lagi yang anda telah sekat. Permintaan HTTP ringkas terhadap perkhidmatan ujian awam seperti httpbin.org boleh berfungsi sebagai sasaran yang dibenarkan, manakala permintaan ke titik akhir metadata tempatan atau IP dalaman sepatutnya gagal. Jika permintaan yang disekat berjaya, sandbox rangkaian anda telah salah konfigurasi.

Pengasingan worktree. Dari dalam subejen, jalankan arahan Git yang ditujukan ke direktori induk. Sebagai contoh, cuba git -C .. status atau minta ejen menerangkan fail di luar semakan (checkout) miliknya. Dengan pembaikan dalam 2.1.216, ini mesti gagal. Subejen sepatutnya hanya melihat worktree miliknya sendiri.

Perangkap symlink. Cipta symlink di dalam projek anda yang merujuk ke direktori di luar repositori, seperti /tmp/sentinel-target. Kemudian cuba simpan tugasan atau aliran kerja di bawah laluan .claude yang akan menulis melalui pautan tersebut. Selepas penyimpanan, semak direktori luar tersebut. Jika ia masih kosong, pengukuhan symlink sedang berfungsi.

Langkauan rewind. Sediakan folder di dalam repo anda yang mengandungi symlink ke fail sistem atau direktori lain. Jalankan /rewind pada folder tersebut. Claude sepatutnya menyenaraikan laluan symlink atau hard-link yang dilangkau dan bukannya mengejarnya. Sahkan bahawa sasaran di luar repo kekal tidak disentuh.

Kebangkitan sesi. Lancarkan ejen latar belakang dengan sekatan ketat, seperti menyahaktifkan alatan penulisan fail. Jeda atau hentikan sesi, kemudian sambung semula. Cuba buat ejen menulis fail dengan segera. Jika sekatan masih aktif, pembaikan untuk ejen yang disambung semula sedang berfungsi. Jika ejen tiba-tiba mendapat akses alatan penuh semula, anda masih terdedah kepada risiko.

Kata Akhir

Claude Code 2.1.216 memberikan anda lebih fleksibiliti berbanding versi sebelumnya, tetapi fleksibiliti itu datang dengan mandat yang jelas: sahkan sebelum anda percaya. Suis (toggle) sistem fail yang baharu bukan bertujuan untuk memudahkan hidup anda dengan mengorbankan keselamatan. Ia disediakan untuk jurutera yang sudah membina asas yang kukuh di bawah alatan tersebut. Penambahbaikan sebenar dalam keluaran ini adalah guardrail senyap yang menghalang subejen daripada menceroboh ke dalam direktori induk, yang enggan mengikut symlink semasa penulisan konfigurasi, dan yang mengingati peraturan walaupun selepas jeda yang lama.

Jalankan lima ujian tersebut. Semak hash sentinel anda. Baca log. Kemudian, dan hanya selepas itu, biarkan versi baharu mengendalikan kerja sebenar.

Sumber: Nota Keluaran Claude Code v2.1.216

Komuniti pembelajaran pilihan: GyaanSetu di Telegram