Skip to content

chore: add sandbox and permission restrictions to Claude Code settings#3332

Merged
KATO-Hiro merged 2 commits intostagingfrom
#3331
Mar 30, 2026
Merged

chore: add sandbox and permission restrictions to Claude Code settings#3332
KATO-Hiro merged 2 commits intostagingfrom
#3331

Conversation

@KATO-Hiro
Copy link
Copy Markdown
Collaborator

@KATO-Hiro KATO-Hiro commented Mar 30, 2026

close #3331

Summary by CodeRabbit

  • New Features
    • サンドボックス実行が有効化され、より安全なコマンド実行環境を提供します
    • サンドボックス外でのコマンド実行が無効化されます
    • 特定ディレクトリへの読み取りアクセスが制限されます
    • 危険なシェル操作や機密ファイル(環境変数、証明書、鍵など)の読み取りを明示的に禁止するポリシーが導入されます

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 30, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 09546e08-62e5-42d5-af77-d989f1ae6ada

📥 Commits

Reviewing files that changed from the base of the PR and between 4731c60 and c5532e7.

📒 Files selected for processing (1)
  • .claude/settings.json

📝 Walkthrough

Walkthrough

.claude/settings.jsonにサンドボックス設定とパーミッションの拒否リストを追加。サンドボックス実行を有効化し、非サンドボックスコマンドを禁止。~/.sshの読み取りと破壊的コマンドや機密ファイルの読み取りを拒否。

Changes

Cohort / File(s) Summary
セキュリティ設定の追加
​.claude/settings.json
トップレベルでsandboxを追加(enabled: true, allowUnsandboxedCommands: false, filesystem.denyRead: ["~/.ssh"])。permissions.denyに危険なシェル操作(Bash(rm -rf *),Bash(curl *),Bash(wget *),Bash(git push *),Bash(chmod 777 *) 等)と機密ファイル読み取りパターン(**/.env, **/.env.*, **/secrets/**, **/config/credentials.json, **/*.pem, **/*.key)を追加。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🔒 サンドボックスで守りを固め
鍵は影へ、危険は門前払い
コマンドの波をやんわり遮り
安全の海原へ帆を上げる ⛵✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PRタイトルは変更内容を正確に反映しており、Claude Code設定にサンドボックスとパーミッション制限を追加した主要な変更を明確に表現している。
Linked Issues check ✅ Passed Issue #3331で要求されたAI Agentの基本的なセキュリティ設定が実装されており、参考記事に従ったサンドボックスとパーミッション制限が適切に設定されている。
Out of Scope Changes check ✅ Passed .claude/settings.jsonへの変更はすべてセキュリティ設定の追加に限定されており、Issue #3331の範囲内で適切に実施されている
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch #3331

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.claude/settings.json:
- Around line 16-21: 設定のReadパターンでスコープが不統一なため、カレントディレクトリ限定の "Read(./.env)" と
"Read(./.env.*)" をサブディレクトリも含む形に変更してください(例: "Read(**/.env)" と "Read(**/.env.*)");
修正対象は .claude/settings.json の現在の Read エントリ("Read(./.env)", "Read(./.env.*)",
"Read(./secrets/**)", "Read(./config/credentials.json)", "Read(**/*.pem)",
"Read(**/*.key)") で、既存の secrets/** はそのままにして .env
関連だけをワイルドカードで再帰的にマッチするように更新してください。
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 42dc21a4-a5c3-47f6-a7c9-64089b467259

📥 Commits

Reviewing files that changed from the base of the PR and between c1b4620 and 4731c60.

📒 Files selected for processing (1)
  • .claude/settings.json

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator Author

@KATO-Hiro KATO-Hiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@KATO-Hiro KATO-Hiro merged commit 0a83747 into staging Mar 30, 2026
3 checks passed
@KATO-Hiro KATO-Hiro deleted the #3331 branch March 30, 2026 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Security] AI Agent のセキュリティ設定をしましょう

1 participant