feat(executor): snekbox による安全な Python 実行環境#10
Open
Mikuto0831 wants to merge 3 commits into
Open
Conversation
- snekbox (nsjail サンドボックス) 対応の Executor を追加 EXECUTOR_TYPE=snekbox で切り替え、未設定は従来の Docker 方式を継続使用 - stdin は base64 エンコードして sys.stdin シムとして注入 (snekbox API は stdin を直接サポートしないため) - docker-compose.snekbox.yml: snekbox サービスのオーバーライド定義 docker-compose.prod.yml と組み合わせて使用する セキュリティ比較: Docker executor: コンテナ分離 (メモリ/CPU/PID/ネットワーク制限) snekbox: nsjail による seccomp-bpf + namespace 分離 (より強固) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- snekbox API の誤ったエンドポイント /snekeval/ を正しい /eval に修正 - healthcheck も /eval を使うよう修正(docker-compose.snekbox.yml / .dev.yml) - docker-compose.snekbox.dev.yml を新規追加(開発用、ポート 8060 をホスト公開) - mise に snekbox:dev / snekbox:dev:down / snekbox:up / snekbox:down / snekbox:logs タスクを追加 - README に snekbox の概要・環境変数・開発/本番手順・ディレクトリ構成を追記 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
snekbox.Executorを新規実装(usecase.Executorインターフェースを実装)POST /snekeval/)を呼び出してコードを実行sys.stdinシムとしてコード先頭に注入EXECUTOR_TYPE=snekbox環境変数で切り替え可能、未設定時は従来の Docker 方式を継続docker-compose.snekbox.ymlを追加(docker-compose.prod.ymlへのオーバーライド)セキュリティ比較
network_mode: nonesnekbox は nsjail でシステムコールレベルの制限をかけるため、コンテナエスケープに対してより強固。
使用方法
# snekbox を有効化して起動 docker compose -f docker-compose.prod.yml -f docker-compose.snekbox.yml up -dTest plan
EXECUTOR_TYPE=snekboxで起動し、コード提出が正常に動作することEXECUTOR_TYPE未設定で Docker executor が従来通り動作すること🤖 Generated with Claude Code