Sandboxing
OpenClaw can run tools inside Docker containers to reduce blast radius. This is optional and controlled by configuration (agents.defaults.sandbox or
agents.list[].sandbox). If sandboxing is off, tools run on the host.
The Gateway stays on the host; tool execution runs in an isolated sandbox
when enabled.
This is not a perfect security boundary, but it materially limits filesystem
and process access when the model does something dumb.
What gets sandboxed
- Tool execution (
exec,read,write,edit,apply_patch,process, etc.). -
- Ixtiyoriy sandboxlangan brauzer (
agents.defaults.sandbox.browser).
- By default, the sandbox browser auto-starts (ensures CDP is reachable) when the browser tool needs it.
Configure via
agents.defaults.sandbox.browser.autoStartandagents.defaults.sandbox.browser.autoStartTimeoutMs. agents.defaults.sandbox.browser.allowHostControllets sandboxed sessions target the host browser explicitly.- Optional allowlists gate
target: "custom":allowedControlUrls,allowedControlHosts,allowedControlPorts.
- Ixtiyoriy sandboxlangan brauzer (
- The Gateway process itself.
- Any tool explicitly allowed to run on the host (e.g.
tools.elevated).- Elevated exec runs on the host and bypasses sandboxing.
- If sandboxing is off,
tools.elevateddoes not change execution (already on host). See Elevated Mode.
Modes
agents.defaults.sandbox.mode controls when sandboxing is used:
"off": no sandboxing."non-main": sandbox only non-main sessions (default if you want normal chats on host)."all": every session runs in a sandbox. Note:"non-main"is based onsession.mainKey(default"main"), not agent id. Group/channel sessions use their own keys, so they count as non-main and will be sandboxed.
Scope
agents.defaults.sandbox.scope controls how many containers are created:
"session"(default): one container per session."agent": one container per agent."shared": one container shared by all sandboxed sessions.
Workspace access
agents.defaults.sandbox.workspaceAccess controls what the sandbox can see:
"none"(default): tools see a sandbox workspace under~/.openclaw/sandboxes."ro": mounts the agent workspace read-only at/agent(disableswrite/edit/apply_patch)."rw": mounts the agent workspace read/write at/workspace.
media/inbound/*).
Skills note: the read tool is sandbox-rooted. With workspaceAccess: "none",
OpenClaw mirrors eligible skills into the sandbox workspace (.../skills) so
they can be read. With "rw", workspace skills are readable from
/workspace/skills.
Custom bind mounts
agents.defaults.sandbox.docker.binds mounts additional host directories into the container.
Format: host:container:mode (e.g., "/home/user/source:/source:rw").
Global and per-agent binds are merged (not replaced). Under scope: "shared", per-agent binds are ignored.
agents.defaults.sandbox.browser.binds qo‘shimcha xost kataloglarini faqat sandbox browser konteyneriga ulaydi.
- O‘rnatilganda (shu jumladan
[]), u browser konteyneri uchunagents.defaults.sandbox.docker.bindsni almashtiradi. - Agar ko‘rsatilmagan bo‘lsa, browser konteyneri
agents.defaults.sandbox.docker.bindsga qaytadi (orqaga moslik saqlanadi).
- Xavfsizlik bo‘yicha eslatmalar:
- Standart image:
openclaw-sandbox:bookworm-slim - Uni bir marta build qiling:
-
- Agar ish maydoniga faqat o‘qish huquqi kerak bo‘lsa,
workspaceAccess: "ro"bilan birlashtiring; bog‘lash rejimlari mustaqil qoladi.
- Agar ish maydoniga faqat o‘qish huquqi kerak bo‘lsa,
-
- Bindlar tool policy va elevated exec bilan qanday o‘zaro ishlashini bilish uchun Sandbox vs Tool Policy vs Elevated ga qarang.
6. Image’lar + sozlash
-
Standart image:
openclaw-sandbox:bookworm-slim - Uni bir marta build qiling:
-
Eslatma: standart image Node ni o‘z ichiga olmaydi. 11. Agar skill’ga Node (yoki boshqa runtime’lar) kerak bo‘lsa, yoki maxsus image pishiring, yoki
sandbox.docker.setupCommandorqali o‘rnating (tarmoq chiqishi + yoziladigan root + root foydalanuvchi talab etiladi). - Sandboxlangan brauzer image’i:
- Standart holatda sandbox konteynerlar tarmoqsiz ishlaydi.
-
agents.defaults.sandbox.docker.networkbilan bekor qiling. - Docker o‘rnatmalari va konteynerlangan gateway shu yerda joylashgan: Docker
17. setupCommand (konteynerni bir martalik sozlash)
-
setupCommandsandbox konteyneri yaratilgandan so‘ng bir marta ishlaydi (har bir ishga tushishda emas). -
U konteyner ichida
sh -lcorqali bajariladi. - Yo‘llar:
- Global:
agents.defaults.sandbox.docker.setupCommand -
- Har bir agent uchun:
agents.list[].sandbox.docker.setupCommand
- Har bir agent uchun:
- Keng tarqalgan xatolar:
-
- Standart
docker.network—"none"(chiqish yo‘q), shuning uchun paket o‘rnatishlar muvaffaqiyatsiz bo‘ladi.
- Standart
-
readOnlyRoot: trueyozishni taqiqlaydi;readOnlyRoot: falsega o‘rnating yoki maxsus image pishiring.
-
- Paket o‘rnatish uchun
userroot bo‘lishi kerak (userni olib tashlang yokiuser: "0:0"deb belgilang).
- Paket o‘rnatish uchun
-
- Sandbox exec xostning
process.envini meros qilib olmaydi. 28. Skill API kalitlari uchunagents.defaults.sandbox.docker.env(yoki maxsus image) dan foydalaning.
- Sandbox exec xostning
29. Tool policy + chiqish yo‘llari
- Tool’larni ruxsat/taqiqlash siyosatlari sandbox qoidalaridan oldin hamon amal qiladi. 31. Agar biror tool global yoki agent darajasida taqiqlangan bo‘lsa, sandboxlash uni qayta yoqmaydi.
-
tools.elevated— xostdaexecni ishga tushiradigan aniq chiqish yo‘li. -
/execdirektivalari faqat vakolatli jo‘natuvchilar uchun amal qiladi va sessiya bo‘yicha saqlanadi;execni butunlay o‘chirish uchun tool policy deny’dan foydalaning (qarang Sandbox vs Tool Policy vs Elevated).
-
- Samarali sandbox rejimi, tool policy va fix-it konfiguratsiya kalitlarini ko‘rish uchun
openclaw sandbox explaindan foydalaning.
- Samarali sandbox rejimi, tool policy va fix-it konfiguratsiya kalitlarini ko‘rish uchun
-
- “Nega bu bloklangan?” degan mental model uchun Sandbox vs Tool Policy vs Elevated ga qarang.
- Uni qattiq yopiq holda saqlang.
38. Multi-agent override’lar
- Har bir agent sandbox + tool’larni bekor qilishi mumkin:
agents.list[].sandboxvaagents.list[].tools(shuningdek sandbox tool policy uchunagents.list[].tools.sandbox.tools). - Ustuvorliklar uchun Multi-Agent Sandbox & Tools ga qarang.