Files
iAs/docker/Dockerfile.tool-builder
T
wunianxiao cacd4436ce fix(sandbox): builder 容器 --user uid:gid + 离线模式,修 cap-drop 写权限
步骤 9: tool_manager build 迁移到 builder 容器验证通过。

问题: --cap-drop ALL 丢掉 CAP_DAC_OVERRIDE,容器内 root 无法写
      bind mount 的非 root 目录(宿主 xiao:1000)。
      这是 cap-drop 正确生效的安全行为,非 bug。

修复:
- builder 容器 --user uid:gid 以宿主用户身份运行,自然能写自己
  的目录,同时保留 cap-drop ALL + no-new-privileges。
- Cargo.toml 改 CARGO_HOME=/tmp/cargo + chmod 777,使任意 uid
  都能复用 serde_json 预缓存。
- cargo build --offline + CARGO_NET_OFFLINE=true,配合 --network
  none 真正离线编译,杜绝恶意代码下载依赖。

端到端: tool_manager create_tool → builder 容器离线编译 →
产物运行成功,审计日志记录正确。
2026-06-22 11:49:31 +08:00

14 lines
624 B
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ias-tool-builder — tool_manager 编译 Rust 工具的隔离环境
# 预缓存 serde_jsontool_manager 生成工具的唯一依赖),支持 --network none 离线编译。
# CARGO_HOME=/tmp/cargo 并 chmod 777,使任意 uid--user 运行)都能复用缓存。
# 运行时由 tool_manager 挂载 tool_dir 到 /workcargo 在 /work 内编译,产物写回宿主。
FROM rust:1.88-slim
ENV CARGO_HOME=/tmp/cargo
RUN cargo new /tmp/seed && cd /tmp/seed \
&& printf 'serde_json = "1.0"\n' >> Cargo.toml \
&& cargo build --release \
&& rm -rf /tmp/seed \
&& chmod -R 777 /tmp/cargo
WORKDIR /work
ENTRYPOINT []