§10 Sandbox
Normative execution posture. Sandbox by default with bin allow-list, cwd jail, and no ambient credentials; native-local only by explicit opt-in.
10.1 Default#
- A runtime MUST execute Adapters in
sandboxmode unless the harness has explicitly opted intonative-local. - Opting into
native-localMUST require an explicit, positive configuration action. Absence of configuration MUST yieldsandbox.
10.2 Sandbox requirements#
In sandbox mode a runtime MUST:
- Allow-list binaries. Spawn only
wrap.binvalues that are on the runtime's allow-list. The allow-list SHOULD be seeded with the activated packs' declaredwrap.binvalues and the runtime's own CLI. A bin not on the list MUST be refused with exit127anderror: sandbox: bin "<bin>" not allowlisted. The runtime MUST NOT resolve an unlisted bare name viaPATH. - Jail the working directory. Set the child's working directory to the
pack root or a per-pack jail. Land
localbinds to this directory. - Inherit no ambient credentials. Provide only credentials minted through
Binding (§8.4) and the pack's
wrap.agent_env. A runtime MUST NOT rely on credentials present in its own environment to satisfy a pack. - Mark the environment. Set
HCP_SANDBOX=sandboxin the child. - Ignore env-flag mocks. Mock is envelope-explicit only (§8.2).
10.3 Native-local#
- In
native-localmode a runtime MAY resolvewrap.binon the hostPATHand MAY relax the cwd jail. - The runtime MUST set
HCP_SANDBOX=native-local. - All other requirements of this specification (grants, confirm, mint fail-closed, Policy coverage) apply unchanged.
- Informative. Native-local expresses a trust decision about a personal machine. It is not a convenience mode.
10.4 Stronger isolation#
- Containers, microVMs, seccomp profiles, read-only filesystems, and per-family
network egress policy are conforming implementations of
sandbox. - A pack MUST NOT need to change to run under stronger isolation. Isolation is a runtime property.
10.5 Reference behaviour (informative)#
The reference runtime implements §10.2 with a process allow-list (bare names or
absolute paths; a bare name matches a path ending in /<name>), a fixed cwd at
the pack root when wrap.workspace is omitted, and HCP_SANDBOX in the child
environment. It requires both sandbox: false and nativeLocal: true to enter
native-local.
10.6 Workspace / exec plane (RFC 0003)#
Wrap names the bin. The exec plane names where that process may read and write. Packs MUST NOT name a driver (object store, microVM, host path). Isolation is a runtime property (§10.4).
Pack field#
Optional wrap.workspace:
| Field | Values | Default |
|---|---|---|
mode | none | ephemeral | workspace | none (pack root, HCP/1) |
home_env | env key names | ["HOME"] when mode is workspace, else none |
file_flags | flags whose next argv token is a file | --file, --json-file, --output, -o, --env-file |
ephemeral is a fresh jail per exec. workspace binds the jail to
privacy.land: local for the Principal; the runtime persists it.
File references#
In sandbox mode a runtime MUST rewrite workspace: prefixes into the jail,
MUST reject host-absolute paths under /etc, /home, /root, and /Users
(error: sandbox: host path not allowed), MUST spawn argv as an array, and
MUST write back --output / -o (and new jail files when mode is
workspace) according to its driver. A runtime MAY accept more URI schemes in
file references and MUST rewrite them into the jail before spawn; those schemes
are not HCP types.
A runtime MUST implement at least a local driver. Additional drivers MUST use prepare → rewriteArgv → spawn → writeback → cleanup. A pack MUST NOT change to run under another conforming driver.
Informative. hcp wrap <bin> scaffolds wrap.bin from an existing CLI.