Skip to main content

Policy schema reference

Complete field reference for the sandbox policy YAML. Each field is documented with its type, whether it is required, and whether it is static (locked at sandbox creation) or dynamic (hot-reloadable on a running sandbox).

Top-level structure

A policy YAML file contains the following top-level fields:
Static fields are set at sandbox creation time. Changing them requires destroying and recreating the sandbox. Dynamic fields can be updated on a running sandbox with openshell policy set and take effect without restarting.

version

integer
required
Schema version number. Currently must be 1.

filesystem_policy

Category: Static Controls filesystem access inside the sandbox. Paths not listed in either read_only or read_write are inaccessible.
boolean
When true, automatically adds the agent’s working directory to read_write.
string[]
Paths the agent can read but not modify. Typically system directories like /usr, /lib, /etc.
string[]
Paths the agent can read and write. Typically /sandbox (working directory) and /tmp.

Validation constraints

  • Every path must be absolute (start with /).
  • Paths must not contain .. traversal components. The server normalizes paths before storage but rejects policies where traversal would escape the intended scope.
  • Read-write paths must not be overly broad — / alone is rejected.
  • Each individual path must not exceed 4096 characters.
  • The combined total of read_only and read_write paths must not exceed 256.
Policies that violate these constraints are rejected with INVALID_ARGUMENT at creation or update time. Disk-loaded YAML policies that fail validation fall back to a restrictive default.

landlock

Category: Static Configures Landlock LSM enforcement at the kernel level. Landlock provides mandatory filesystem access control below what UNIX permissions allow.
string
default:"best_effort"
How OpenShell handles kernel ABI differences.

process

Category: Static Sets the OS-level identity for the agent process inside the sandbox.
string
default:"sandbox"
The user name or UID the agent process runs as.
string
default:"sandbox"
The group name or GID the agent process runs as.
Neither run_as_user nor run_as_group may be set to root or 0. Policies that request root process identity are rejected at creation or update time.

network_policies

Category: Dynamic A map of named network policy entries. Each entry declares a set of endpoints and a set of binaries. Only the listed binaries are permitted to connect to the listed endpoints. The map key is a logical identifier; the name field inside the entry is the display name used in logs.

Network policy entry

string
Display name for the policy entry. Used in log output. Defaults to the map key.
object[]
required
Hosts and ports this entry permits.
object[]
required
Executables allowed to connect to the associated endpoints.

Complete example

The following policy grants read-only GitHub API access and npm registry access:

Default policy

The built-in policy applied when no custom policy is provided.

Gateway authentication

How the CLI resolves and authenticates with a gateway.