seatbelt provider - #333
Closed
drscrewdriver wants to merge 8 commits into
Closed
Conversation
- 新增 SeatbeltExecutionResourceProvider (kind='seatbelt') - SBPL profile 生成器,支持网络/路径读写隔离 - is_macos() + inspect_seatbelt_availability() 平台检测 - ActionResourceRegistrar._normalize_code_sandbox 支持 'seatbelt' - 新增 register_seatbelt_sandbox_action() 注册入口 - __init__.py 注册 Seatbelt provider
SBPL Profile 设计改进: - 基础能力: process-exec*, process-fork, signal, mach(*), ipc-posix* - 文件读取: 全局允许 (allow file-read*) — AI agent 需要读系统库 - 文件写入: 白名单模式 (writable_paths + temp dirs) - 受保护路径: protected_paths 禁止写入 (last-match-wins, 覆盖 allow) - 禁止读取: deny_read_paths 同时禁止读写 (保护 secrets) - 设备文件: /dev/null, /dev/ptmx, pseudo-tty - 网络: network-outbound 开关 - realpath 防符号链接绕过 接口变更: - 移除 read_paths (全局可读) - 新增 writable_paths (白名单可写) - 新增 protected_paths (禁止写入, 覆盖 writable_paths) - 新增 deny_read_paths (禁止读写)
- 移除不存在的 ExecutionResourceProvider 基类继承,改为 duck-typing - 将 create_handle 重写为 async_ensure/async_health_check/async_release - 清理文件拼接残留(659→394行) - TYPE_CHECKING 导入替代运行时导入
- BUG-1: sandbox-exec -f - 不支持 stdin,改用临时文件 + -f - BUG-2: SBPL 语法 (allow mach(*)) 无效,改为 (allow mach*) - BUG-3: SBPL 语法 (deny network) 无效,改为 (deny network-outbound) 修复后沙箱可正常执行,6 项可配置限制全部验证通过。 添加 .gitignore 规则忽略本地 TDD 验证资产。
- 恢复 .gitignore 到 main 分支状态 - 添加 tests/test_seatbelt_bugs.py (11 项 TDD 测试)
This was referenced Jul 31, 2026
Merged
Collaborator
|
Superseded by #351, merged as The accepted integration branch started from this PR and retains all eight original commits and authors. Maintainer commits then merged current Closing because the contribution-preserving integration has landed, not because the contribution lacked value. |
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.
rewite with supported_kinds = ("code_execution",)