Sandboxing AI-generated code should be built on allowlists enforced at the syscall/file/network boundary (Bubblewrap + seccomp/eBPF filtering) rather than denylists of forbidden actions, because the agent's action space is open-ended and attackers/agents will find paths outside any enumerated ban list.
It relocates the security boundary from prompt-level instructions and tool-level permission checks down to the OS/kernel enforcement layer, which is the only place where an arbitrary shell command from a model can be reliably constrained. Engineers building tool-executing agents must decide sandbox granularity before, not after, granting filesystem and network access.
For any agent that executes code or shell commands, default-deny at the lowest enforceable layer and make the allowlist a per-workspace artifact; treat denylists as advisory only.
Allowlist-based sandboxing provides better security than denylist-based approaches for executing AI-generated code.
Using Bubblewrap and set-comp-bpf to filter file system and network calls during tool execution.