mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-06-14 03:15:58 +00:00
fix(security): mount host Docker socket only in aio (DooD) sandbox mode (#3517)
* fix(security): mount host Docker socket only in aio (DooD) sandbox mode The default Compose stack mounted /var/run/docker.sock read-write into the root gateway container in every sandbox mode, including the default `local` mode that never uses it -- an unnecessary host-escape surface (DooD = root-equivalent host control). deploy.sh already gated the socket *check* on sandbox_mode != local, but the Compose files mounted it unconditionally. Move the socket mount to an opt-in docker/docker-compose.dood.yaml overlay that deploy.sh / docker.sh append only when detect_sandbox_mode() returns `aio`. Default (local) and provisioner/Kubernetes modes no longer expose the host daemon. Tighten the socket existence check from != local to == aio. Document the DooD threat model in SECURITY.md. Reported by @greatmengqi. * refactor(docker): address review on socket-hardening PR - docker.sh: use absolute path for the dood overlay (match deploy.sh, drop cwd dependency) - deploy.sh: drop now-dead DEER_FLOW_DOCKER_SOCKET exports in down/build paths - docker-compose.yaml: fix stale header comment to point at the overlay Addresses codex + reviewer feedback on #3517. --------- Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
This commit is contained in:
@@ -196,6 +196,20 @@ start() {
|
||||
services="frontend gateway provisioner nginx"
|
||||
fi
|
||||
|
||||
# Only aio mode (AioSandboxProvider without provisioner_url) needs the host
|
||||
# Docker socket. Mount it via the opt-in docker-compose.dood.yaml overlay so
|
||||
# the default (local) and provisioner modes never expose the host daemon.
|
||||
# Mounting the socket = root-equivalent host control; see SECURITY.md.
|
||||
if [ "$sandbox_mode" = "aio" ]; then
|
||||
local docker_socket="${DEER_FLOW_DOCKER_SOCKET:-/var/run/docker.sock}"
|
||||
if [ ! -S "$docker_socket" ]; then
|
||||
echo -e "${YELLOW}⚠ Docker socket not found at $docker_socket — AioSandboxProvider (DooD) will not work.${NC}"
|
||||
exit 1
|
||||
fi
|
||||
echo -e "${YELLOW}Mounting host Docker socket into gateway (DooD = host root-equivalent). See SECURITY.md.${NC}"
|
||||
COMPOSE_CMD="$COMPOSE_CMD -f $DOCKER_DIR/docker-compose.dood.yaml"
|
||||
fi
|
||||
|
||||
echo -e "${BLUE}Runtime: Gateway embedded agent runtime${NC}"
|
||||
echo -e "${BLUE}Detected sandbox mode: $sandbox_mode${NC}"
|
||||
if [ "$sandbox_mode" = "provisioner" ]; then
|
||||
|
||||
Reference in New Issue
Block a user