settings.json

sandbox.excludedCommands

型string[]記述場所どの設定ファイルでも可

サンドボックス内で実行すべきではないコマンドのリスト(例: ["git", "docker"])を指定します。

記述例

{
  "sandbox": {
    "excludedCommands": ["docker *"]
  }
}

使い方・用途

  • DockerやWSL2環境下のWindowsバイナリなど、サンドボックスの制約(名前空間やプロキシ制限)と互換性のないツールを実行させるために使用します。
  • サンドボックスの制限でコマンドが失敗した際の「脱出ハッチ」として機能し、特定のコマンドを隔離環境の外で実行させることで開発作業の停滞を防ぎます。
英語原文(公式ドキュメントより)

Commands that should never run in the sandbox (e.g., ["git", "docker"]). See https://code.claude.com/docs/en/sandboxing#configure-sandboxing

関連ドキュメント

関連する変更履歴

v2.1.290(1件)

Fixed
git clone オプションの短い形式が、sandbox.excludedCommands の git * といった git パターンによるサンドボックス免除を引き継ぐ問題を修正した。現在は長い形式と同様に扱われる
英語原文を表示
Fixed a short form of a git clone option keeping the sandbox exemption from a git pattern such as git * in sandbox.excludedCommands; it is now treated like the long form

v2.1.282(1件)

Changed
sandbox.excludedCommands を変更した。managed settings または --settings で allowUnsandboxedCommands: false が設定されている場合や、managed の allowManagedDomainsOnly: true が設定されている場合、プロジェクトおよびローカル設定のエントリは無視されるようになった
英語原文を表示
Changed sandbox.excludedCommands to ignore project and local settings entries when managed settings or --settings set allowUnsandboxedCommands: false, or managed allowManagedDomainsOnly: true

変更後

サンドボックスが厳格モードや管理者必須モードのとき、プロジェクトやローカル設定にある excludedCommands の除外指定が効かなくなり、開発者自身がサンドボックスの対象外コマンドを広げられなくなります。管理者はマシンごとに一律のサンドボックス ポリシーを維持できます。

v2.1.281(1件)

Fixed
サンドボックスの excludedCommands のエントリが、git rev-parse --git-dir、シェル組み込みコマンドと同名のプログラム、[WIP] や # 行を含むコミットメッセージに一致しない問題を修正した
英語原文を表示
Fixed sandbox excludedCommands entries not matching git rev-parse --git-dir, programs named like shell builtins, and commit messages containing [WIP] or # lines

v2.1.277(1件)

Fixed
sandbox.excludedCommands の glob で複合 Bash コマンドの一部だけがマッチした場合に、コマンド全体がサンドボックス除外になってしまう問題を修正した。現在はすべての部分がマッチする必要がある
英語原文を表示
Fixed a sandbox.excludedCommands glob exempting an entire compound Bash command from the sandbox when only one part matched; every part must now match

v2.1.72(1件)

Fixed
ワイルドカードルールのマッチング精度やサンドボックス除外コマンド、拒否ルールの適用範囲など、パーミッション周りの不具合を修正
英語原文を表示
Fixed several permission rule matching issues: wildcard rules not matching commands with heredocs, embedded newlines, or no arguments; sandbox.excludedCommands failing with env var prefixes; "always allow" suggesting overly broad prefixes for nested CLI tools; and deny rules not applying to all command forms

変更後

「常に許可」や「常に拒否」の設定が期待通りに働くようになり、セキュリティ設定の信頼性が向上します。

関連ドキュメント

v2.1.34(1件)

Fixed
サンドボックスから除外されたコマンド(sandbox.excludedCommands または dangerouslyDisableSandbox 経由)が、autoAllowBashIfSandboxed が有効な場合に Bash の権限要求ルールを迂回するバグを修正しました。
英語原文を表示
Fixed a bug where commands excluded from sandboxing (via sandbox.excludedCommands or dangerouslyDisableSandbox) could bypass the Bash ask permission rule when autoAllowBashIfSandboxed was enabled

変更後

この修正により、サンドボックスのセキュリティモデルが強化され、より安心してClaude Codeを利用できるようになります。意図しないコマンドの実行を防ぎ、システムへのアクセスを厳密に制御できるため、セキュリティリスクが低減されます。

関連ドキュメント