settings.json

sandbox.filesystem.allowRead

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

denyReadで拒否された領域内の特定のパスに対して、読み取りを再許可します。

記述例

{
  "sandbox": {
    "filesystem": {
      "denyRead": ["~/"],
      "allowRead": ["."]
    }
  }
}

使い方・用途

  • セキュリティのためにホームディレクトリ全体を読み取り拒否(denyRead)しつつ、現在のプロジェクトディレクトリ(.)だけをピンポイントで読み取り可能にしたい場合などに使用します。
  • 厳格な制限を維持したまま、開発に必要な最小限のアクセス権限だけを柔軟に提供できます。
英語原文(公式ドキュメントより)

Paths to re-allow reading within denyRead regions. Takes precedence over denyRead for matching paths. See https://code.claude.com/docs/en/sandboxing#granting-subprocess-write-access-to-specific-paths

関連ドキュメント

関連する変更履歴

v2.1.299(2件)

Fixed
フォルダ名に波括弧・丸括弧・バックスラッシュを含むサンドボックスの denyRead および allowRead グロブが、Claude Code の設定チェックとサンドボックスで異なる解釈をする問題を修正した
英語原文を表示
Fixed sandbox denyRead and allowRead globs with braces, parentheses or backslashes in a folder's name being read differently by Claude Code's settings checks than by the sandbox
Fixed
サンドボックスの glob allowRead および allowWrite エントリの起点ディレクトリがシンボリックリンクに置き換えられた際に再チェックされない問題を修正した
英語原文を表示
Fixed sandbox glob allowRead and allowWrite entries not being re-checked when the directory they start from is replaced by a symlink

関連ドキュメント

v2.1.290(1件)

Added
管理対象設定がユーザー設定のサンドボックス allowRead パスや許可ドメインを上書きする場合、/status と doctor に警告を表示するようにした
英語原文を表示
Added a /status and doctor warning when managed settings ignore user-configured sandbox allowRead paths or allowed domains

変更後

managed settings によってユーザー設定のサンドボックスの allowRead パスや許可ドメインが無効化されている場合に、/status や doctor でそのことを確認できるようになる。これにより、自分が設定した読み取り許可や許可ドメインが実際には適用されていないことを見逃さずに済む。

関連ドキュメント

v2.1.179(1件)

Fixed
Linux環境にて大規模なディレクトリ構造に対してサンドボックスのdenyRead/allowReadを適用すると、Bashツールの説明が肥大化しセッションが動作しなくなる問題を修正
英語原文を表示
Fixed a sandbox denyRead/allowRead glob over a large directory tree making the Bash tool description enormous and the session unusable on Linux

変更後

セキュリティのために厳格なファイルアクセス制限を適用しても、CLIの動作が重くなったりクラッシュしたりすることなく、安全に開発を継続できます。

関連ドキュメント

v2.1.77(1件)

Added
サンドボックスのファイルシステム設定に、denyRead 領域内での読み取りを再許可する allowRead を追加しました
英語原文を表示
Added allowRead sandbox filesystem setting to re-allow read access within denyRead regions

変更後

サンドボックスのセキュリティ制限を維持しつつ、必要なファイルへのアクセスだけをピンポイントで許可できるため、柔軟な環境構築が可能です。

関連ドキュメント