Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Claude Code の Sandbox 機能を Anthropic Sandbox Run...
Search
tomoki10
June 16, 2026
Technology
1.1k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Claude Code の Sandbox 機能を Anthropic Sandbox Runtime(srt) で試そう!/lets-play-anthropic-sandbox-runtime
Claude Code Meetup #6 で登壇した内容です。
https://aid.connpass.com/event/394427/
tomoki10
June 16, 2026
More Decks by tomoki10
See All by tomoki10
チームで安全にClaude Codeを利用するためのプラクティス / team-claude-code-practices
tomoki10
7
5.5k
re:Invent2025 3つの Frontier Agents を紹介 / introducing-3-frontier-agents
tomoki10
0
1.3k
AWS Security Agentの紹介/introducing-aws-security-agent
tomoki10
0
1.8k
Kiro Autonomous AgentとKiro Powers の紹介 / kiro-autonomous-agent-and-powers
tomoki10
0
2.1k
CDK Vibe Coding Fes
tomoki10
1
1.1k
cdk initで生成されるあのファイル達は何なのか/cdk-init-generated-files
tomoki10
1
1.7k
Devin(Deep) Wiki/Searchの活用で変わる開発の世界観/devin-wiki-search-impact
tomoki10
1
4.2k
AI駆動で進化する開発プロセス ~クラスメソッドでの実践と成功事例~ / aidd-in-classmethod
tomoki10
2
5.4k
DevinはクラウドエンジニアAIになれるのか!? 実践的なガードレール設計/devin-can-become-a-cloud-engineer-ai-practical-guardrail-design
tomoki10
2
5.2k
Other Decks in Technology
See All in Technology
20260903 Tokyo Jazug Night #62 | Azure エンジニアよ、 その環境は本当にセキュアか?
olivia_0707
1
630
WAF 運用改善の承認サイクル/SRE_BizReach_MIXI_1
visional_engineering_and_design
1
360
多層防御と最⼩権限で実現する、安全なAIエージェント設計パターン
lycorptech_jp
PRO
0
210
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
2
150
全員がプロダクトへ向き合う組織を持続成長させるために——組織づくりのフライホイールと4象限 / The Flywheel Model and Four Quadrants for Organizational Design
hiro_torii
4
900
OpenTelemetry eBPF Instrumentationの舞台裏 / Behind the Scenes of OpenTelemetry eBPF Instrumentation
ymotongpoo
1
180
Azure Cost Management の FOCUS コストデータを迷わず読むための“3つの軸”
tetsuyaooooo
0
160
Azure App Service / Container Apps の組み込み認証
kuniteru
0
210
振り返りこそエンジニアの本領
negima
0
330
「重なり」は迎える側がつくる ― 人もAIエージェントも歓迎するプロダクトエンジニアリング ―
go0517go
PRO
0
260
SQL文一行も書けない人事がCortexもろもろを使って人事業務を楽にしてみる
ponponmikankan
0
120
Where Is JetBrains AI Heading- — Central CLI, Air Alpha, and the Agentic Development Stack
x5gtrn
PRO
0
140
Featured
See All Featured
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
810
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.8k
A designer walks into a library…
pauljervisheath
211
25k
Leo the Paperboy
mayatellez
8
2.2k
The Language of Interfaces
destraynor
162
27k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
510
Large-scale JavaScript Application Architecture
addyosmani
515
110k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Ethics towards AI in product and experience design
skipperchong
2
360
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
400
Embracing the Ebb and Flow
colly
88
5.2k
Chasing Engaging Ingredients in Design
codingconduct
0
300
Transcript
Claude Code の Sandbox機能を Anthropic Sandbox Runtime (srt) で 試そう!
Claude Code Meetup Japan #6 佐藤智樹 / 2026年6月16日
アカウント X : tmk2154 GitHub : tomoki10 2020年 入社 バックエンドエンジニア IoT宅配ボックス、工場IoTなどIoTシス
テムのバックエンド、インフラ構築に従 事 2023年 テクニカルマネージャー 部署内全体技術力向上のため施策実施 2025年 テクニカルマネージャー AI駆動開発など生成AIを活用した生産性 向上を目的として活動 自己紹介 2
非決定論的な挙動に疲れていませんか? 3
決定論的な挙動に、癒されよう 4
ファイルシステム:書き込みは既定で全拒否、読み込みは既定で許可 allowWrite / denyWrite / allowRead / denyRead で調整 .bashrc
, .zshrc , .gitconfig , .git/hooks/ , .vscode/ , .claude/ などへの書き 込みは常に保護 ネットワーク:全通信をプロキシ経由にして既定で遮断 allowedDomains でドメインを許可制に指定(ワイルドカード可) HTTP通信とそれ以外のTCP通信を別々に制御 コマンド実行:Sandbox内は自動許可、外は許可フローへフォールバック macOSはSeatbelt、Linuxはbubblewrapで隔離 Sandboxで制御できる3つの範囲 5
Claude Code や Claude Cowork などの Sandbox 機能だけを使える機能 このSandboxの仕組みは srt
としてOSS公開 https://github.com/anthropic-experimental/sandbox-runtime 正式名称は @anthropic-ai/sandbox-runtime コンテナ不要でOSレベルにファイルシステムとネットワークを制限 ルートファイルシステムの読み取りはデフォルトで可能 ツール・ランタイムコマンド実行のため? エージェントによる破壊(書き込み)を防ぐことを重視? Anthropic Sandbox Runtime (srt)とは 6
任意のコマンドを1行でsrtを通して実行可能 % npm install -g @anthropic-ai/sandbox-runtime % srt -c "curl
anthropic.com" 設定は2パターンで可能 ~/.srt-settings.json :全体でデフォルトで適用 コマンド実行時に設定ファイルを指定 % srt --settings ./srt-settings.json -c "ls -l /hoge" プロジェクト単位でファイルを作成して、CLI実行時の保護もまとめて可能 srtを単体で使う方法 7
ホームディレクトリ配下で、プロジェクト外を保護 { "filesystem": { "allowWrite": ["."], "denyRead": ["~/"] } }
カレントディレクトリ配下だけ書き込み可。 .claude や .gitconfig も自動保護 % srt -c "ls -l ~/.aws" total 0 ls: /Users/hoge/.aws: Operation not permitted % srt -c "ls -l" total 8 -rw-r--r-- 1 hoge staff 277 Jun 16 15:50 srt-settings.json % srt -c "touch zzz.txt" % ls -l ... -rw-r--r-- 1 hoge staff 0 Jun 16 18:04 zzz.txt 動作例①ファイルシステム制御 8
通信先のドメインをallowlistで制御 { "network": { "allowedDomains": ["github.com", "*.github.com", "*.npmjs.org"] } }
許可したドメイン以外への通信はブロック ドメインとサブドメインは別途指定が必要 # 上記の設定なし % srt -c "curl https://github.com" curl: (56) CONNECT tunnel failed, response 403 # 上記の設定あり( ステータスコードのみ出力) % srt -c "curl -o /dev/null -s -w "%{http_code}" https://github.com" 200 動作例②ネットワーク制御 9
Claude Code 内部でSandbox機能を使う場合の話 コマンド実行の許可は、2つのモードから選択可能 Auto-allow:Sandbox内は自動許可、外はフォールバック Regular permissions:従来どおり都度確認 デフォルトで設定を固定する方法 設定キーは autoAllowBashIfSandboxed
、既定でtrue。承認疲れを減らしつつ、危険な操 作はAutoモードと合わせて停止可能 動作例③コマンド実行の許可方式 10
MCPサーバからホストのファイルシステムやネットワークへのアクセスを制限して実行可能 { "mcpServers": { "drawio": { "command": "srt", "args": ["npx",
"-y", "@drawio/mcp"] } } } commandを srt にするだけで、ファイルとネットワークへのアクセスを制限可能 以下は例として書いてもらったAWS構成図。不要な権限を絞ってMCPを利用可能 実はMCPサーバやスキル経由のCLI利用もラップ可能 11
Claude Codeの内部機能としてSandboxを使う場合の注意 ReadやEditなどのClaude Code内蔵ツールはSandboxの対象外 これらはサブプロセスではなく、Claude Code内部で動作するため Sandboxで読み込み禁止でも、Readツールは許可ダイアログ経由で読み取り可能 内蔵ツールはPermissions(allow / deny)で別途制御が必要
{ "$schema": "https://json.schemastore.org/claude-code-settings.json", "permissions": { "allow": [ "WebFetch(domain:github.com)" ] }, "sandbox": { "enabled": true, "network": { "allowedDomains": [ "github.com", "*.github.com" ] } } } 注意:Claude Code 内部の Sandbox の範囲 12
以前公開した記事 [Claude CodeのSandbox機能を改めて整理してみた] https://dev.classmethod.jp/articles/claude-code-sandbox-202604/ より詳細に解説された記事 [生成AIを使ったソフトウェア開発におけるセキュリティの問題点について整理してみた] https://dev.classmethod.jp/articlessecurity-on-software-development-with- generative-ai/ 参考情報とその他 13
SandboxはAIエージェントに決定論的な境界を付与可能 Sandboxの仕組みは srt としてOSS化され、単体でも利用可能 ファイルシステム・ネットワーク・コマンド実行を制御可能 ただし内蔵ツールは範囲外、Permissionsとの併用が必要 決定論的挙動に癒されよう!! まとめ 14
実践的なワークショップや伴走支援も実施中!支援実績数10社以上! https://classmethod.jp/services/aidd/ 宣伝1: AI駆動開発の支援やってます! 15
宣伝2: AWS CDK Conference 2026 開催します! 16