Module 4 · Part A of 3

The OpenShell Sandbox

Module 3 gave OpenClaw persistent context and unattended triggers. Prompt rules and harness checks still influence what it attempts, while OpenShell puts the final allow-or-deny decision in a sandbox the agent cannot rewrite.

On this page, you send real commands to your launchable, read each verdict, and trace it to the rule that produced it. Then you inspect a second boundary: the operator control plane above the sandbox.

OpenShell separates control entry, policy enforcement, agent state, tool access, and model routing. Keep this map in view as the page moves from the sandbox argument to live policy checks.
Keep the three product roles separate as you trace enforcement.

OpenShell is agent-agnostic. The same boundary can enclose OpenClaw, Hermes, LangChain deepagents, or another process that needs operating-system-level containment.

Where each defense layer intervenes

Suppose untrusted content tells an agent to read a credential and send it away. Three different layers get a chance to stop that action, and each layer answers a different question.

The live work on this page measures that final layer. You will attempt an action, observe the allow-or-deny verdict, and connect the verdict to the mechanism that enforced it.

Why enforcement belongs below the model

Assume a valid-looking request can still be harmful

Zero trust rejects implicit trust based only on where a request came from. OWASP's prompt-injection guidance applies the same discipline to agents: constrain tools, restrict privileges, and assume external content can steer the model.

Grant only the authority the task needs

Saltzer and Schroeder described this as the principle of least privilege: each component receives only the permissions needed for its work. Because the discipline predates agents, it transfers cleanly to this setting.

Measure boundaries instead of trying to prove intent

Rice's theorem rules out a general test for non-trivial behavior of arbitrary programs. An agent with code execution deserves the same caution: instrument the boundaries around what runs instead of assuming a static check can prove every future action safe.

How the sandbox mechanisms answer testable questions

This launchable combines four operating-system mechanisms. Each answers a question you can test, and together they apply policy at more than one boundary. Read the live policy later on this page before treating any one guarantee as universal.

Prompt rules and application guardrails shape the agent before kernel containment enforces the final boundary. The blocked arrow shows an outbound action stopped before it reaches disk or network.

1 · Where can this process connect?

A network namespace (netns) gives the agent an isolated network stack. Outbound access starts closed. An HTTP CONNECT proxy provides the only route out. Open Policy Agent (OPA) checks the requesting binary, host, port, and path against policy. Whoever edits that policy decides which connections are allowed.

2 · Which files can it reach?

Landlock is a Linux Security Module that restricts future filesystem access. Here it limits new file operations to paths granted by policy. That is strong enforcement, but compatibility mode, OverlayFS, and handles opened before restriction still matter. Read the live policy and test the path you intend to expose.

3 · Which kernel operations can it request?

A system call, or syscall, asks the Linux kernel to perform an operation. seccomp is Linux syscall filtering; its BPF filter checks each request against an allowlist. A denied call returns EPERM, meaning "operation not permitted," before the operation runs. This launchable excludes dangerous primitives such as ptrace, mount, and setuid.

4 · How much authority does it start with?

The agent runs as a non-root process under the unprivileged sandbox user. A successful exploit therefore starts with less authority. The lower starting authority reduces blast radius, though it does not prove escalation is impossible. The host, container configuration, and syscall policy remain part of the security boundary.

Vocabulary in these four mechanisms

Network policy

Network namespace / netns
Isolated Linux network stack: devices, routes, firewall rules, and socket ports. network_namespaces(7)
Ingress / egress
Ingress is traffic entering the sandbox; egress is traffic leaving it. Default-deny means neither direction is open unless policy grants it.
CONNECT proxy
HTTP tunnel proxy to a requested host and port; safe deployments restrict allowed targets. MDN CONNECT
OPA
Policy engine that evaluates structured input and returns decisions to enforcement code. OPA docs
Binary, host, port, path
Egress policy inputs: executable identity, target name, TCP port, and requested URL path.

Filesystem boundary

Landlock
Linux Security Module that lets an unprivileged process restrict its own future access. Kernel docs
Ambient rights
Access a process would otherwise inherit from the OS, parent process, mounts, or credentials.
Workspace tree
The directory subtree a policy grants. Verify the live policy and kernel compatibility before treating it as a complete filesystem boundary.
Bind mount
A filesystem subtree made visible at another path, including across chroot boundaries. mount(2)
Symlink race
A checked path changes through a symbolic link before use. symlink(7)

Syscall boundary

seccomp
Linux syscall filtering that reduces kernel surface reachable by a process. Kernel docs
Syscall allowlist
The syscall set allowed to run; everything else receives a policy action.
BPF layer
Filter program that checks syscall numbers and arguments before execution. Kernel docs
TOCTOU / inspection race
Time-of-check/time-of-use bug; seccomp avoids pointer dereference races inside the filter. Kernel docs
EPERM / EACCES
Linux errno names for operation not permitted and permission denied. errno(3)

Process identity

Agent process
The OS process running the agent and tools inside these boundaries.
Non-root / unprivileged user
A nonzero UID subject to normal kernel permission checks. capabilities(7)
Linux capability
A split-out root power such as CAP_SYS_ADMIN or CAP_SETUID. capabilities(7)
ptrace, mount, setuid
Dangerous primitives for process control, filesystem attachment, and identity change. ptrace(2) · mount(2) · setuid(2)
Privilege escalation
Gaining authority beyond assignment: root, extra capabilities, broader file access, or broader network access.

Shape the runtime first

Before you drive the sandbox yourself, make the agent healthy by recovering the runtime if it is degraded, so that every live cell below has a working agent to talk to.

The diagram traces what happens on each tool call, and the cells after it let you make those calls and read back the kernel's answer.

Same runtime as Kickstart. Every cell here drives the same OpenClaw agent you connected on the Kickstart page.

Prompt rules and application guardrails shape the agent before kernel containment enforces the final boundary. The blocked arrow shows an outbound action stopped before it reaches disk or network.

Watch the kernel decide

The four mechanisms above are running on your box, so you can make each one decide for itself instead of taking the diagram on trust.

The cell below runs one command at a time. You ask the box a question, it executes that command in your sandbox, and the result comes back carrying three pieces of information.

The starting catalog walks the questions you would ask of a box like this, ranging from reaching the open internet all the way to rewriting the agent's own persona, and you are free to edit any command or add your own.

Deep · TrajectoryRun a multi-command sandbox trajectory?

Going further: a whole trajectory

A real agent chains several commands together to pursue a goal that no single isolated cell above ever attempted on its own. Describe one such goal in the box below and the agent plans the whole sequence of shell commands it would run to reach it before running each command in your sandbox and showing you the result. Watch the plan. Somewhere along it the kernel refuses to go further, because the containment you hardened earlier stops the runaway trajectory cold.

One rule carries over from the single commands. A secret printed at any step is already out even when a later step's egress is denied, so edit the goal or the planning prompt and take the trajectory further once you have seen that happen.

Read your launchable's live policy, then see it as a map

Now that you have watched the kernel decide, you can see that every one of those verdicts traces back to a single policy file, which is worth reading off your launchable before you work with it. The cell below calls helpers.policyGet(), which runs openshell policy get over the operator terminal and parses the result for you.

The page now computes from your box's policy instead of a baked example. The cell keeps its code in a dropdown, where you can inspect the exact call without making it the main lesson.

With your policy in hand, the cell draws it as an interactive map below, where each node on the right is an endpoint your policy names alongside a few that no policy allows. Change the calling binary and watch the egress edges flip, since the kernel decides by binary rather than by host and so integrate.api.nvidia.com stays reachable for openclaw while it is refused for curl.

Clicking any target opens the rule that governs it, so that you can read which binaries that endpoint allows alongside the reasoning the kernel uses to reach its verdict. The View policy source control prints the YAML it drew from, which is the same text you fetched a moment ago.

Operator-token plane. The amber band sits above the checkpoint, the escalation axis the egress rules never see.

Prove where the sandbox holds, then confirm it live

You do not have to take the robustness claim on faith, because the openshell policy prove command checks a property of a policy or returns a counterexample while the proxy makes a deterministic allow/deny decision on every connection. You compute that same decision in the browser from your launchable's real policy, then run the action in the live sandbox and confirm the kernel's verdict matches your prediction.

The policy test below exercises binary identity. The policy grants egress per program rather than per host so the proxy always checks which binary opened a connection before it ever looks at the destination it is bound for. An allowed program like openclaw therefore reaches the inference endpoint while a stray curl to that identical endpoint is refused. Pick any action from the buttons below to watch its static verdict appear at once, and the inference-endpoint action shows this same-host flip most clearly.

Each result is a real kernel decision. The live half of each flow runs on the launchable you connected in Kickstart through openshell sandbox exec, so each result you read back is a decision the kernel made on the wire. Keep your launchable open in another tab so its access session stays fresh.
When the predicted verdict and the live result agree, the box enforces the policy that the static analysis predicted. A disagreement instead means the box is behaving in a way your prediction never captured, whether that is a preset someone added without your knowing or a real gap the box managed to hide from the static view. Either way, you learn something important before you start trusting the box in earnest.

Above the sandbox: the control plane

Everything so far measured what the agent can do, but the bigger question is who can reconfigure the agent through the plane sitting above it. How you reach that plane depends on the system, and on this box the plane is one gateway that you reach with the same OPENCLAW_GATEWAY_TOKEN from Module 3 at operator.admin scope, none of which passes through the sandbox at all.

What that one credential reaches:

Chained together, those calls become an escalation pathway. An attacker who reads the persona can then plant a cron job that fires long after the conversation ends and patch the running config to widen what the agent may do. A mid-task turn redirects it, and a restart of the runtime makes the new shape take hold.

The sandbox you hardened above governs the agent's syscalls, yet none of these moves is a syscall the agent makes. How hard the box is and how far the control plane reaches are two separate questions, and teams routinely lock down the first while leaving the second wide open.

The protection here is deliberately one-sided, since the sandbox stays strong against the agent's own mistakes and even against a compromise of the agent while having no visibility at all into whoever holds the control plane sitting above it. You should guard access to that plane as carefully as you would guard root, because on this box it can reconfigure the agent's identity and schedule entirely outside the reach of anything the sandbox checks.

Enumerate it against your own launchable. The cell only reads, so it measures the reach and leaves everything unchanged.

What the sandbox cannot catch

Everything so far was the agent's own actions, and the kernel held the line. Two distinct kinds of harm still slip past it. The first is the control plane you just enumerated, which reconfigures the agent from above the checkpoint. The second travels inside an authorised envelope where every individual action is permitted and the real damage lives in how those actions compose.

Untrusted input, private data, and external communication together form the lethal trifecta.

Risk appears when these permissions compose. A policy can correctly allow one outbound endpoint, but that endpoint is still full-duplex: the request leaves and the response comes back as more input. Once hostile content can steer the model, it can ask for private data and send that data through a channel the sandbox regards as allowed. Mediating any one leg above the sandbox removes the path the exploit needs.

The red center shows a path across allowed pieces rather than a single forbidden action. Hostile content influences a runtime that can read protected state and use an approved channel. Because the channel also brings responses back, a network allowlist alone cannot decide whether an allowed connection is safe.

These gaps are real on a default box, and none of them is decidable by the network and filesystem policy:

Choose the control by failure mode

A sandbox limits what a compromised process can reach. The application and operating practice still own decisions whose meaning is invisible to the kernel.

Failure modeWhat the sandbox contributesControl still needed above it
Goal hijack or prompt injectionLimits reachable files, processes, and destinations after the model is steeredInput provenance, approval for consequential actions, and behavioural evaluation
Tool misuseRestricts the OS and network envelope in which the tool runsPer-tool authorization, argument validation, rate limits, and confirmation for irreversible calls
Identity or privilege abuseStarts the process as a non-root identity and blocks selected escalation pathsWorkload-specific identities, minimal token scopes, short lifetimes, rotation, and audit
Supply-chain or unexpected code executionReduces the files, syscalls, and egress available to installed codePinned and verified dependencies, install policy, and integrity monitoring
Memory or context poisoningCan protect selected files when policy makes them read-onlyWrite provenance, reviewable history, trust labels, and recovery from a known-good state

The categories align with the OWASP Top 10 for Agentic Applications. Use the table to pick an enforcement point instead of asking one layer to recognize every kind of harm.

The sandbox establishes a floor rather than a complete defense. The practice that follows from it is to grant the agent the smallest envelope it needs, to prove what that envelope guarantees, and to staff the layers above it for the failures no proof can reach.

References

Comprehensive list at Going Further · References.

← Module 3c: Always-On