20f7c3ba9c
引入两类安全边界:统一审批=授权边界(上一提交),一次性 Docker
容器=执行隔离边界(本提交)。LLM 即使执行恶意代码也只能在受限容器
内运行。
spec.rs: 新增 SandboxSpec(profile/network/memory/cpus/pids_limit/
read_only),默认 profile=local 不启用容器。
executor.rs: 按 sandbox.profile 选择执行后端
- local: 本地 spawn(env_clear + 白名单注入)
- stdio: ias-stdio-runner,--network none --read-only --cap-drop ALL
--security-opt no-new-privileges,仅 bind mount 工具二进制(ro)+tmpfs /tmp
- network: ias-network-runner(预留自行联网工具)
- builder: ias-tool-builder(供 tool_manager 编译)
全局开关 IAS_DOCKER_SANDBOX=1,未启用时行为不变(向后兼容)。
tool_manager: build_tool 支持 IAS_DOCKER_BUILDER=1 在 ias-tool-builder
容器内离线编译(--network none,挂载 tool_dir 到 /work)。
docker/: 三类 Dockerfile + build-images.sh 构建脚本。
- stdio-runner: debian-slim + ca-certificates,无网络只读
- network-runner: 预留联网工具
- tool-builder: rust:1.88-slim 预缓存 serde_json,支持离线编译
spec 迁移: 17 个普通工具追加 sandbox.profile: stdio;tool_manager
保持 local(自身在宿主操作文件系统)。
端到端验证: datetime 工具本地模式 +08:00,Docker 模式 +00:00(UTC),
--rm 无容器残留。
19 lines
560 B
YAML
19 lines
560 B
YAML
name: web_search
|
|
desc: 联网搜索互联网最新信息。支持 AI 摘要,返回标题、URL和内容摘要。用于查询实时资讯、最新事实、热点新闻等。需要 TAVILY_API_KEY
|
|
type: http
|
|
tool: web_search
|
|
path: /target/release/web_search
|
|
risk_level: low
|
|
timeout_secs: 30
|
|
env:
|
|
- TAVILY_API_KEY
|
|
params:
|
|
- name: query
|
|
required: true
|
|
desc: 搜索关键词,如"Rust 2024 edition 新特性"、"今天比特币价格"
|
|
- name: max_results
|
|
desc: 返回的最大搜索结果数量(1-20),默认5条
|
|
|
|
sandbox:
|
|
profile: stdio
|