Bocal is an experimental local, single-user prototype. It is not a hosted or multi-tenant service and does not claim conformance to Core Shell. A Linux guest runs as an AArch64 Alpine userland on the Unkernel Linux WebAssembly runtime in a child Node.js process. Security tests demonstrate behavior for the tested image and host; they do not prove that hostile guest code cannot escape the runtime.
The guest has no network stack and receives no host filesystem mount. Optional
host-side HTTPS egress is available only through an operator allowlist; DNS and
IP checks reject loopback, link-local, private, metadata and IPv6-equivalent
targets, redirects are denied and responses are bounded. On Linux,
the worker can additionally be launched inside a hardened scope: a dedicated
unshare bootstrap creates user, mount, PID, network, UTS and IPC namespaces,
hides the operator's home directory, exposes the read-only checkout, the pinned
image and the host system paths (/usr, /lib, /lib64, /etc and the Node
installation) as read-only binds, mounts a private tmpfs for worker temporaries,
and applies file descriptor, process and core-dump rlimits. It then applies
no_new_privs and a raw seccomp denylist that kills dangerous syscalls such as
ptrace, bpf, keyctl, mount operations, unshare/setns, and clone with
CLONE_NEW* flags. clone3 is a deliberate exception: it returns ENOSYS
(errno 38) so glibc falls back to clone for thread creation; that fallback is
killed if it carries namespace flags. Namespace creation is therefore blocked,
but not every clone-family call is killed. When the host
provides subordinate UID/GID ranges, the worker runs as the operator's first
subordinate identity instead of the operator's own host account. Otherwise the
hardened scope is unavailable. Use a low-privilege host account for untrusted
workloads.
Linux per-worker systemd resource limits are applied only when a real manager
probe succeeds. The active profile is MemoryMax=1024M, MemorySwapMax=0,
CPUQuota=100%, and TasksMax=128; auto mode warns and continues without
those host quotas if the manager is unavailable. A separate local systemd
test observed those controls. The MCP benchmark process did not receive them;
its report marks host quotas unavailable. These cgroups are resource controls,
not a host security boundary.
The operator config also controls max_concurrent_jobs (1 or 2) and
allow_agent_terminal (default false). Agent terminal tools are disabled
unless explicitly enabled; they give the MCP client an interactive shell inside
the guest and must be treated as a high-privilege capability.
The operator config field host_isolation accepts:
"best-effort"(default): use the hardened worker scope when the host probe accepts it; otherwise continue with cgroup limits only."required": fail closed before starting a worker if Linux namespaces, systemd cgroup controls or the probe are unavailable."disabled": keep the legacy worker launch with cgroup limits only.
bocal doctor reports the effective mode, any AppArmor/SELinux confinement and
sandbox_capabilities returns the isolation mode. Sandbox metadata is journaled
in a private 0600 file under the data directory; after a daemon restart,
non-destroyed sandboxes are restored as inert failed tombstones instead of
being silently forgotten. A SIGKILL of a
cgroup-controlled worker is reported as the structured worker.resource_limit
event. An AppArmor profile template is shipped in
packages/cli/resources/apparmor/bocal-worker; it must be adapted to the local
Node path and checkout before installation. The real-guest check is
pnpm test:host-isolation:real and the seccomp boundary by
pnpm test:seccomp:real; both report NOT_RUN when the host cannot provide
the hardened scope.
Three optional modes are disabled by default and must be enabled one by one in
the operator config. Each one also requires the matching capability in
allowed_capabilities; a flag alone never activates it, and an agent cannot
enable any of them through MCP.
allow_packages(package.install) downloads a pinned.apkfrom an HTTPS directory allowlist, checks its SHA-256, extracts only safe regular files into/workspace/.pkgs, and never writes to guest system directories. The guest keeps UID 1000 and has no network.allow_guest_root(shell.root) lets a singlesandbox_execrun as guest UID 0. This is weakened isolation inside the guest only: the Bocal host process still refuses to run as root, the job stays in its cgroup and keeps the timeout, output and stop-evidence limits. Guest root can read any guest path, including.bocal-control, but file transfers and jobs share the same single active lease, so staging is empty while a root job runs and no in-flight transfer data can be stolen. The CLI requires--root --yesand emits a warning on stderr.allow_tunnel(network.tunnel) adds a bounded HTTPS request proxy with its own origin allowlist and request budget. The guest still has no network stack; only the host proxy performs DNS and HTTP, with the same SSRF checks as the existing allowlist proxy. A guest helperbocal-net GET|HEAD <url>can request a response through the guest agent, which relays it over GSP and IPC to that same host proxy. Only one guest request may be in flight; the body is capped and the allowlist never leaves the host.
bocal doctor reports each mode as warning when enabled and ok otherwise.
sandbox_capabilities lists the effective capabilities. The daemon records a
fingerprint of the operator config and restarts when it changes, so a previous
set of security flags cannot stay active silently.
Every mutating MCP tool call is recorded by the daemon in a single-writer,
append-only, hash-chained JSONL file under the daemon data directory
(audit.jsonl, rotated once to audit.jsonl.1). Records carry the tool
name, the sandbox, terminal, job or snapshot identifier, the effective host
isolation mode, the outcome and error code, the duration and the affected
byte counts.
- Commands and paths are not recorded by default. The operator tier
audit.record_commandsadditionally records thesandbox_execcommand string and the guest paths of file mutations. URLs are never recorded. - The chain detects editing, it is not a signature. A record rewritten
in place breaks the hash chain and
bocal audit verifyreports the gap. A local attacker with write access to the data directory can rewrite the whole history including the chain; treat the log as tamper-evident against accidental or casual agent-side modification, not as tamper-proof against a host-level attacker. - Single writer. Only the daemon appends. One-shot operator CLI verbs
(
image fetch,doctor,update) are out of audit scope. - Audit failures never change a tool outcome. They are counted,
logged, and surfaced by
bocal audit verifyand theaudit_writabledoctor check.
Repository open/diff/apply keeps host paths out of every tool input and
output: the agent names a repository by its operator-configured label, and
apply-back is a fourth privileged mode (operator flag plus capability,
audited). The apply conflict check refuses when a host file changed since the
open, and ignore-matched paths never reach the host. Residual risks an
operator accepts by enabling repo.apply: the guest content of the
workspace is written into the named repository (review the diff first), and
the host walk reads the repository directory (no symlink follows).
Third-party guest images are anchored on an Ed25519 signature verified against operator-configured trust keys at fetch time and re-verified in the worker at boot. The manifest pins the compiled unkernel runtime version (the guest-agent ABI check) and carries advisory limits hints that never raise the operator limits. Residual risk an operator accepts: the signer's key is trusted for arbitrary guest root filesystems — add only keys whose images you audit. The official image keeps its compiled-in trust root.
Third-party guest images are anchored on an Ed25519 signature verified
against operator-configured trust keys at fetch time and re-verified in the
worker at boot. Trust keys live only in the operator config; no MCP tool can
add one. Manifest limits hints are advisory and never applied. Guest root
(run_as_root) applies only to the official pinned image: third-party init
scripts are not audited by this project, so allow_guest_root plus
shell.root still refuses root inside a third-party image. The official
image keeps its compiled-in trust root.
Linux x86_64 remains the verified reference: worker namespaces, cgroup
quotas, the seccomp denylist and the hardened systemd scope are active there.
On macOS arm64 (verified by CI) those mechanisms do not exist: every worker
runs without per-worker host quotas, the doctor reports isolation as
degraded (warning), and host_isolation: "required" fails closed by design.
Treat macOS as a developer convenience for trusted work, not as a hardening
boundary.
A fifth privileged mode, allow_ports plus the port.publish capability,
lets an agent publish a guest loopback listener at a host 127.0.0.1 port.
The guest still has no network stack: bytes are relayed through the GSP
control stream, and no guest port below 1024 is accepted. The host bind is
loopback only, at most max_published_ports per sandbox (default 1, cap 4),
with a per-relay byte budget and idle timeout; the mapping dies with the
sandbox. Residual risk an operator accepts: any local process on the host can
reach the published port — that is the operator's choice, made visible in
bocal doctor output.
Bocal is publicly released and installable with npm install --global bocal.
Every image release matches the pinned manifest and includes its
corresponding-source materials. The product version (PRODUCT_VERSION), the
pinned Unkernel runtime version (UNKERNEL_RUNTIME_VERSION) and the kernel
dependency pin (KERNEL_DEPENDENCY_PIN) are published as single constants in
@bocal/protocol; the internal @bocal/runtime-unkernel package carries its
own package version. Other host architectures and operating systems are not
verified.
GitHub private vulnerability reporting is the intended channel on the public repository. No alternate security email has been designated. Please do not put sensitive vulnerability details in a public issue.
- Bocal is not hardened for multi-tenant or hostile-code workloads.
- Resource quotas are host-dependent. They are reported as active only after systemd confirms the worker scope; other host platforms are untested.
- The worker uses a subordinate host identity only when
/etc/subuidand/etc/subgidranges exist; Linux namespaces and the seccomp denylist are best-effort and still not a certified boundary. - Guest egress denial, bounded workspace behavior, cancellation and cleanup have real-guest tests, but tests cannot rule out runtime escapes.
- Every published image release includes its corresponding-source archive,
notices, SBOM, and checksums. Their integrity checks are engineering
evidence, not a legal opinion. The separate Unkernel npm runtime scope is
not covered by this image package; see
docs/licenses/unkernel/THIRD-PARTY.md.