diff --git a/docs/bubblewrap-backend-plan.md b/docs/bubblewrap-backend-plan.md new file mode 100644 index 000000000..3b3787106 --- /dev/null +++ b/docs/bubblewrap-backend-plan.md @@ -0,0 +1,204 @@ +# ARTEX-owned Go/bubblewrap Linux backend + +Status: selected implementation direction, 2026-11-27; implementation and runtime +qualification remain future work. Companion: [managed execution design](managed-execution-scope-and-audit.md), +[runtime issue #554](https://github.com/BaaRai/ARTEX/issues/554), and +[audit issue #553](https://github.com/BaaRai/ARTEX/issues/553). + +## Decision and rationale + +Implement a narrowly scoped Linux backend in ARTEX's Go code that invokes a +supported external `bwrap` executable. Keep upstream bubblewrap responsible for +its isolation primitives. ARTEX owns its launch policy, lifecycle, gateway binding, +capability reporting and integration tests. This proposal neither forks bubblewrap +nor reimplements namespace/mount primitives in Go, and requires no CGO binding. + +The selected backend adds no Node/SRT runtime requirement and does not depend on +Fence. Existing Node-dependent ARTEX tools and frontend builds remain separate +requirements. SRT, Fence and other runtimes remain references or possible future +adapters; this decision does not claim they are universally inferior or that a +smaller wrapper is automatically secure. + +The reason to own this adapter is the fit to ARTEX's single policy gateway, +task-bound provenance, explicit unsupported behavior and whole-task cleanup. +Adopting a higher-level runtime would still leave those responsibilities with +ARTEX while introducing another configuration/lifecycle contract. The cost of the +chosen approach is explicit ownership of platform compatibility and security +regressions. Keep that scope bounded rather than recreating a general desktop or +cross-platform sandbox framework. + +Bubblewrap's [security model at v0.13.1](https://github.com/containers/bubblewrap/blob/v0.13.1/README.md#sandbox-security) +assigns security-policy and argument-selection responsibility to the caller. That +release is a documentation reference, not an approved minimum version or a claim +that every distro package has been qualified. Implementation PRs must establish a +supported version/capability matrix and reproducible package or artifact pins. + +## Component and trust boundaries + +```text +trusted ARTEX scheduler / judge / approvals / existing budget ledger + | + portable Runner contract + | + Go Linux supervisor + protected task session + | + bwrap: tool process tree, restricted filesystem, + separate PID and network namespaces + | + task-private proxy bridge with no general host-network access + | + authoritative ARTEX egress gateway + authentication -> policy -> budgets -> final dial -> audit +``` + +The bridge is a narrow transport, not another policy engine or an unrestricted +SOCKS escape route. All permitted target traffic also passes through the gateway; +there is no direct-allow path that omits attribution or final-dial checks. Native +Go HTTP clients use the same gateway/policy contract. File tools and managed local +MCP need enrolled execution ownership; remote/shared executors require separate +capability and attribution handling. The logical worker's model loop stays outside +the tool sandbox. Remote SSRF/RCE second hops remain outside local containment. + +## Responsibilities and acceptance + +| Component | ARTEX must implement or integrate | Acceptance boundary | +| --- | --- | --- | +| Launch specification | Executable/argv, cwd, explicit environment, mounts, session and limits; immutable server-owned policy | No shell concatenation by the adapter; shell execution only when explicitly requested by the tool contract; no loading policy from an untrusted workspace | +| Runtime discovery | Trusted executable/helper paths, version and required-feature probes | Reject missing/incompatible capabilities before untrusted execution; do not execute a task-writable binary from PATH | +| Filesystem | A controlled read-only tool environment; separate writable workspace and bounded temporary/output storage | No host root/home/config or Docker/D-Bus socket exposure by default; read-only secrets are still secrets; test symlink/path races and sibling-task access | +| Environment and descriptors | Minimal explicit environment and intended stdio/bridge descriptors | No inherited controller credentials, proxy escape routes, control sockets or unintended open file descriptors | +| Network | Mandatory separate network namespace for the managed Linux profile; protected per-session gateway transport | Direct host/external connections fail even with proxy variables removed; both allowed and rejected attempts have honest observation/coverage semantics | +| Lifecycle | Prepare, start, cancel/revoke, wait and cleanup; supervisor restart/failure handling | Kill descendants, close existing tunnels and bridge connections, prevent new work, bound cleanup time and record incomplete cleanup | +| Resource domain | Integrate cgroup v2 or another demonstrated host mechanism plus I/O/storage limits | Required limits cover descendants before the first untrusted instruction; a create-then-move race is not acceptance; missing delegation rejects that strict profile | +| Gateway | Trusted task/run binding, final IP checks, typed host/port rules, redirects, revocation and byte/request budgets | An allowed hostname cannot bypass address constraints; reused connections and CONNECT/WebSocket/SSE streams cannot outlive revoked authorization | +| Audit | Existing capture integration plus independent metadata, stages and source health | Opaque HTTPS remains host/port metadata unless a qualified visibility mechanism provides the path; no invented full-URL or OS-denial detail | +| Packaging and maintenance | Supported distro/container matrix, dependency provenance, fixes and rollback ownership | Clean install, absence, incompatible versions, security updates and rollback are tested; task-time downloads and blanket privileged containers are excluded | + +Use existing executor privilege dropping and startup isolation checks. The bwrap +supervisor must not turn a root controller into a root tool executor. Namespace, +capability, mount, device and session flags are derived from an explicit tested +profile, not copied from an illustrative command. Do not silently omit a required +namespace to improve compatibility. Host LSM/user-namespace restrictions and +container nesting need explicit diagnosis, without relaxing existing protections. + +CPU/memory/process limits do not solve disk/output budgets, and per-worker limits +do not bound a whole task. Extend ARTEX's existing token/turn/time accounting with +gateway and supervisor dimensions. Attribute helper overhead and define task-wide +aggregation, measured overshoot and pause/resume semantics. Failure of a mandatory +limit, policy channel or audit durability gate stops strict admission/execution. + +`exec.CommandContext` killing one direct child is not sufficient evidence of tree +cleanup. Likewise, closing a listening proxy socket is not evidence that existing +tunnels have stopped. Tests must hold a child and an established stream open, +cancel/revoke the task, and assert that both stop within the published bound. + +## Initial support and deliberate limits + +- First qualify Linux amd64/arm64 with declared distro, kernel, bwrap, execution + identity and cgroup/delegation combinations. Test supported Docker configurations + with the existing `no-new-privileges` and credential boundaries intact. +- Start with controlled tool environments, shell/custom tools and task-owned local + MCP sessions, plus HTTP(S) and supported proxied TCP. An offline profile is useful + during development but is not permission to silently disable network for a task + that requested it or misreport the resulting coverage. +- UDP/ICMP/raw SYN/QUIC, arbitrary host mounts, shared or remote MCP, nested + containers and browser-specific requirements need separate capability profiles + and tests. Unsupported strict requests fail with an actionable reason. Never + grant host networking or broad sockets just to make an unsupported tool work. +- Preserve Linux/macOS/Windows controller builds. bwrap is a Linux backend, not a + native Windows/macOS implementation. Native Windows is deferred beyond this first release; + macOS requires its own qualified adapter before claims of local containment. + Explicit Linux guest/remote profiles identify both host and guest and their + credential, mount, evidence and revocation boundaries. +- A shared-kernel sandbox is not VM-level isolation. Stronger hostile-artifact + execution can use a separately evaluated VM/gVisor profile. Deception resilience + means containment, evidence and budgets, not honeypot detection or anonymity. + +## Four-PR delivery plan + +Use **four PRs total, including the existing design PR #555**: three subsequent +implementation PRs, each delivering an independently useful capability. The former +ten work items become implementation/review checklists or explicitly deferred +scope, not ten separate review and release gates. Later numbers below are planning +slots, not GitHub PR IDs. + +| PR | Deliverable | Dependencies | Exit criterion | +| --- | --- | --- | --- | +| 1 | Existing design PR #555: scope, policy/audit/Runner contracts and support boundaries | — | Agree the bounded first release; documentation only, no new runtime dependency or default | +| 2 | Searchable access audit end to end: trusted access/content provenance, existing producers, URL/time API and minimal inert evidence UI | 1 | Trace a synthetic URL to its task/tool and outcome with body capture off; truthful gaps, redaction, restart/spool-full, retention/archive references and query limits | +| 3 | Authoritative gateway and action authorization: scope, network budgets, existing judge/approval and untrusted-content boundaries | 1, 2 | Final-dial/DNS/redirect/revocation and deny precedence; trusted sessions and secondary-target checks; remote-content framing/summary propagation and independent action-authorization regressions; coverage limited to enrolled paths | +| 4 | Complete opt-in Go/bwrap Linux backend: process/filesystem isolation, private gateway bridge, resource enforcement, packaging and qualification | 2, 3 | No direct-egress bypass; pre-exec descendant/task limits; complete process/tunnel cleanup; supported amd64/arm64 host/container tests, install/absence diagnostics, basic overhead/security fixtures and rollback; unsupported profiles fail closed | + +PR 4 can use a reviewable commit series within one PR: supervisor/filesystem, +private network transport, then resources/packaging/acceptance. These are internal +checkpoints, not additional PR dependencies or partially qualified releases. +Keep it limited to declared Linux tools and environments; do not add native +Windows/macOS or arbitrary-protocol support just to reduce the headline PR count. + +### First-release scope and explicit follow-ups + +The first release is a usable Linux audit-and-enforcement path, not the entire +sandbox ecosystem roadmap. PR 2 provides immediate investigation value on existing +managed producers, without waiting for bwrap. PR 3 enforces enrolled transports; +it must not claim confinement of arbitrary host processes before PR 4. PR 4 is +enabled opt-in only after its combined isolation, gateway, cleanup, resource and +platform acceptance passes. + +Keep all five controller release builds and preserve existing security startup +checks. Native Windows/macOS sandbox implementations and new managed Linux-guest/ +remote-executor deployments are follow-ups, not hidden subprojects in PR 4. Until +qualified, those strict local profiles report unsupported; no host fallback. +Raw/UDP/ICMP/QUIC, general browser/nested-container compatibility and stronger +VM/gVisor profiles are also outside the initial declared tool matrix. + +First-release deception resilience consists of containment, trusted evidence links, +budget stops and reuse of existing judge/operator approvals. Known secondary +destinations receive deterministic scope checks; uncertain indirect actions still +require existing review/denial, and hard denies cannot be overridden. New automated +deception classifiers, generalized evidence-corroboration engines, rich investigation +workflows and suspicion-triggered pause/resume automation are follow-ups. No +honeypot-detection, anonymity or remote-second-hop containment claim is introduced. + +Remote-content prompt-injection defense is explicitly in the first release: +trusted provenance in PR 2, existing input-boundary/action-authorization integration +in PR 3, and hard execution containment in PR 4. It is distinct from deferred +automatic deception classification. See the ADR for ingestion, summary/memory and +synthetic-fixture requirements. + +Tests, deployment diagnostics, dependency provenance/SBOM updates, basic overhead +measurements and rollback belong to the PR that introduces the behavior. There is +no separate packaging or benchmark PR. Advanced cross-platform/fleet benchmarks +and richer analytics can follow; required security tests cannot be deferred. + +## Required regression evidence and ownership + +Use synthetic local services, test DNS and inert content. Include namespace +unavailability, failed helper startup, removed proxy environment, cross-task +workspace/credential attempts, redirect/DNS/IP mismatches, gateway outage, +long-lived tunnel revocation, descendant cleanup, aggregate quota exhaustion, +spool-full behavior and supervisor restart. For a supported profile, a security +property that fails is a failed test; it must not become a skip. Unsupported hosts +are identified by separate preflight tests, not a successful-enforcement label. + +The ARTEX backend maintainers own argument/profile review, helper protocol +compatibility, supported-platform CI and bwrap security-update intake. Each backend +PR must identify maintenance/rollback ownership before merge; use a supported +version range and artifact/package provenance rather than accepting any binary +that prints a version. Test approved updates before promoting them. An upgrade or +rollback stops incompatible managed tasks and preserves audit history. + +This document records the implementation direction and its costs. No runtime +implementation, performance result, Windows security qualification or production +rollout is claimed by the design PR. + +## Pre-submission verification gate + +Run relevant checks in an isolated checkout on the designated Linux verification +host before committing/submitting each revision. Record the tested base plus exact +working-tree content, environment, commands, outcomes and skips. A documentation +revision uses document/link/plan checks and any relevant existing regressions; +that is not a sandbox implementation test. Implementation PRs require actual +functional and isolation acceptance before submission. A failed or unavailable +required check blocks submission; CI and one-host success do not replace the wider +supported OS/architecture/container qualification. Keep production deployments and +their configuration untouched by the verification checkout. diff --git a/docs/managed-execution-scope-and-audit.md b/docs/managed-execution-scope-and-audit.md new file mode 100644 index 000000000..1ed3e1922 --- /dev/null +++ b/docs/managed-execution-scope-and-audit.md @@ -0,0 +1,684 @@ +# Managed execution scope and access audit + +Status: **proposed; not implemented by this document**. + +Revised 2026-11-27: select an ARTEX-owned Go/bubblewrap Linux backend. +Delivery is bounded to four PRs total, including this design PR. Implementation +and runtime qualification remain follow-up work. + +Tracking: [access audit #553](https://github.com/BaaRai/ARTEX/issues/553) and +[Go/bubblewrap backend #554](https://github.com/BaaRai/ARTEX/issues/554). +This is PR 1 of the proposed sequence. It changes no runtime behavior or defaults. + +## Problem and success criteria + +An operator investigating an unexpected URL access needs to find the observed +attempt, its task and tool invocation, the effective policy and approval, and any +response or target-side evidence. A matching string in a task transcript is not +evidence of network access. Missing captures are not proof of non-access. + +At the same time, the authorized destination boundary should apply to actual +connections from managed tools and their children, including connections whose +destinations were not declared in the tool arguments. This requires execution +containment and deterministic egress enforcement, alongside semantic review. + +Success means: + +- Managed direct egress cannot exceed an operator-authorized policy. +- Judge approval cannot override a deterministic denial. +- A URL/time-window investigation explains observation, attribution and gaps. +- Full-body recording is optional; required metadata is independent of it. +- Remote second-hop actions have separate review and evidence semantics. +- Deceptive target content cannot grant permissions or be promoted directly into + verified findings; execution and investigation have enforceable budgets. +- Unsupported coverage and reduced isolation are visible, never silently promoted + to an enforcement guarantee. + +## Baseline and existing components + +The review baseline is ARTEX +[`3cb0638`](https://github.com/BaaRai/ARTEX/tree/3cb06383fd99ffe7686abe1d375de11da7cfad54). +This proposal extends existing controls rather than replacing them: + +- `guard` and `intercept`: tool rules, judge, target approval/pins and trace. +- `server/execpriv.go` and `server/isolation*`: privilege dropping and startup + isolation checks. +- `traffic`: HTTP, SOCKS, TCP/UDP evidence, rewrite history, HAR and archives. +- `egress`: pacing/noise governance, which is not itself a task allowlist. + +Related discussions: #421, #423, #347, #422 and #440. Revalidate integration points +against the current main branch before each implementation PR. + +A focused integration review on 2026-11-27 checked packaging, startup isolation +and budgets at [`e5c7bfc`](https://github.com/BaaRai/ARTEX/tree/e5c7bfcbdd893db26c08f0b004e0169b4ab6ca85). +This supplements the earlier full behavior baseline. Current main already has +task/intent token and turn budgets in `agent/budget.go` and `server/engine_budget.go`. +Extend these and the existing task clock; do not create competing accounting. +New gateway/OS limits and evidence events must integrate with their lifecycle. + +## Trust boundaries + +```text +operator-approved policy revision + | +tool arguments -> deterministic rules + semantic judge + approval + | +ARTEX execution manager (trusted session/provenance) + | +unprivileged tool + children inside the Go/bwrap Linux backend + | +authenticated ARTEX egress gateway + policy -> rate control -> final dial -> metadata / optional payload evidence + | + authorized target A + | + remote action A -> B + [outside the local execution boundary] +``` + +The native Go HTTP path must use the same policy/gateway contract even though it +does not run inside a child-process sandbox. Control-plane traffic is separate. +The gateway and audit writer are trusted services; children cannot modify their +configuration, credentials, event store or policy revision. + +### What is inside a worker's sandbox + +The sandbox boundary is the worker's tool execution environment, not its entire +logical agent loop. Model calls, scheduling, judge/approval and audit stay in the +trusted control plane. Managed shell/custom tools and local MCP process trees run +inside their assigned execution boundary. Native HTTP uses the policy gateway; +file tools must use an isolated executor or an explicitly constrained file service. +Inventory every process, file and network entry point so wrapping Bash does not +leave an alternative host-level path. Unsupported paths fail a strict profile. + +Prefer separate workspaces and execution sessions for each worker run. A persistent +runner versus invocation-local processes is a lifecycle/performance decision for +the implementation; this ADR does not claim one permanent sandbox per worker. +Wrapping a process does not isolate an individual goroutine inside the ARTEX server. +Cross-run credentials, writable files and IPC must not defeat task separation. + +### Remote-content prompt-injection defense + +This is part of the four-PR first release, not deferred with advanced automated +deception analysis. Cover the full path from external content to the next action: +HTTP responses/headers, browser extracts where already integrated, downloaded files +when read, shell/scanner stdout/stderr, MCP results, imported reports and derived +summaries. A permitted destination does not make its response instructions trusted. + +At the reviewed main baseline, ARTEX already has code-owned prompt tails in +[`agent/untrusted_prompt.go`](https://github.com/BaaRai/ARTEX/blob/e5c7bfcbdd893db26c08f0b004e0169b4ab6ca85/agent/untrusted_prompt.go), +default-on nonce-framed tool output via +[`agent/untrusted_boundary.go`](https://github.com/BaaRai/ARTEX/blob/e5c7bfcbdd893db26c08f0b004e0169b4ab6ca85/agent/untrusted_boundary.go), +MCP description warnings in +[`server/assembly.go`](https://github.com/BaaRai/ARTEX/blob/e5c7bfcbdd893db26c08f0b004e0169b4ab6ca85/server/assembly.go), +and untrusted-input instructions for the judge in +[`intercept/prompt.go`](https://github.com/BaaRai/ARTEX/blob/e5c7bfcbdd893db26c08f0b004e0169b4ab6ca85/intercept/prompt.go). +Extend and verify those paths rather than introduce a competing prompt framework. +Source inspection and unit tests do not prove the model is immune to injection. + +1. **Carry provenance as trusted metadata.** Assign source/attempt/artifact IDs, + origin, content type, retrieval time and observed redirect chain outside target + text. Associate derived summaries and evidence references with their sources; + source text cannot supply its own trusted role, task identity or approval. + PR 2 stores/displays available provenance and gaps without needing full bodies. +2. **Keep data out of control-instruction channels.** Preserve code-owned rules and + nonce framing through truncation, extraction, compaction, planner/worker handoff + and memory reuse. Derived external content remains untrusted; summarizing it + cannot promote it into system instructions, operator goals, persistent policy + or approved tool configuration. The agent/judge receives it as labeled data. + Strict managed admission requires the boundary enabled; a legacy opt-out must + not silently qualify as this strict profile. Limits bound content and processing. +3. **Reauthorize the resulting action independently.** PR 3 keeps policy revisions, + task goals and grants server-owned, checks concrete tool destinations/actions, + and treats purported operator approvals or judge directives in any tool field + as data. The model/judge cannot expand scope, approve itself, change budgets or + turn off auditing. Secret reads, file writes, command execution and infrastructure + access require their applicable checks even when the destination is allowed. + Uncertain indirect actions retain existing operator review/denial. +4. **Contain execution and preserve safe evidence.** PR 4 enforces files/processes, + forced egress, budgets and cleanup even if a model proposes the induced action. + Log the source reference, proposed invocation, verdict and actual observed + effect separately; do not invent causal certainty. Suspicious excerpts are + bounded/redacted and rendered as inert text. Viewing evidence must not execute + scripts, fetch embedded links/images or replay the target request. Original + evidence, when retained, stays access-controlled and separate from model input. + +PR 3 owns the existing-boundary integration and prompt/compaction regressions; +PR 2 supplies provenance/evidence plumbing, and PR 4 supplies enforcement tests. +Use synthetic webpage/header, MCP/tool-output and inert-file fixtures containing +fake high-priority roles, forged approval claims, delimiter-like text, induced +secret/callback requests and a summary-to-next-turn propagation case. Check the +rendered roles/frames and preserved trust/source metadata, then independently +assert no unauthorized policy change, action, cross-task access or network grant. +Include benign quoted instructions/code as controls; simple keyword removal or +another LLM judging the text is not the security boundary. + +These are layered risk reductions, not a promise that a model never follows an +injection, a new automatic honeypot classifier, or complete prevention of leakage +to an already authorized destination. Hard action/resource boundaries must hold +even when model-level defenses fail; report observed coverage and residual risk. + +### SSRF, RCE and lateral movement + +A permitted request to A may cause A to contact B. Neither a local network +namespace nor a proxy on the ARTEX host can constrain A's own network. A remote MCP +service, device or VM also needs an independently managed executor to claim that +coverage. + +Use deterministic validation for recognizable secondary destinations and typed +tool parameters. Keep judge review for payload intent, indirect effects and +multi-step behavior. In strict mode, an unresolvable secondary scope or material +scope expansion requires operator approval or denial. A known out-of-policy +destination requires an authorized policy revision, not just a judge's approval. + +An operator authorization should identify target scope, action class, duration and +limits. The model cannot grant its own exception. Where the test environment is +controlled, target-side network policy provides an additional enforceable boundary. + +Arbitrary remote code cannot be completely interpreted by argument parsing or a +judge. Neither mechanism can guarantee that every hidden secondary destination is +identified. Local observation, authorized callback/target logs, and inference must +remain distinct evidence classes. A response from A alone proves neither access +to B nor the absence of it. + +### Deception resilience and counter-exploitation (anti-honeypot) + +The intended benefits are reduced local damage from hostile target content, +traceable evidence when an agent is misled, and bounded wasted effort. A sandbox +does not automatically recognize honeypots, hide source IP/request fingerprints, +or stop a permitted target from recording requests. + +| Scenario | Proposed control | Remaining limit | +| --- | --- | --- | +| Hostile content induces a secret read or unauthorized callback | Explicit filesystem policy, protected host secrets and deterministic egress | Tool-readable data can still leave through an allowed endpoint | +| Downloaded content attacks a browser/parser/tool | Untrusted artifact handling, applicable code/tool approval, isolated process tree | No guarantee against kernel/runtime compromise; no implicit safe-to-execute verdict | +| A service fabricates a finding or misleading success response | Evidence provenance, corroboration, contradictions and judge/operator review | A model assessment is not proof of deception or a vulnerability | +| Crawl/output/download traps consume resources | Task/run budgets enforced by gateway, supervisor and scheduler | Limits and overshoot must be measured; bwrap alone is not a quota manager | +| An unusual but legitimate service looks suspicious | Record evidence and uncertainty; allow an auditable operator disposition | Suspicion alone must not produce a confirmed honeypot label | + +Treat target instructions as untrusted inputs. The sandbox can block a resulting +disallowed action, but does not prevent the model seeing or believing malicious +content. Preserve existing prompt-injection controls and tool/action review. + +Use existing evidence before requesting new verification. Corroboration must have +known provenance and remain within authorized scope, approvals and budgets. A +target-supplied credential or suspected honeytoken is not automatically used or +validated against another service. A denial, error or unusual response is not by +itself proof of a honeypot. Do not add stealth/evasion or out-of-scope probes as a +response to suspicion. + +Hard policy/budget limits stop affected execution and further scheduling. +Evidence-based suspicion can pause a run for operator review under a documented +policy; ordinary failures remain ordinary failures. Preserve available evidence, +usage and the stop reason before cleanup where possible, without delaying the +enforcement action. Resumption requires authorized disposition and, when needed, +an approved policy/budget revision. A model cannot raise its own limits. + +These controls are planned capabilities. They do not extend local containment to +remote SSRF/RCE second hops or guarantee that deceptive content is detected. + +## Proposed policy contract + +Use a versioned server-owned policy with at least: + +| Field | Meaning | +| --- | --- | +| policy ID, revision, digest | Stable identity and exact effective version | +| task/run binding | The execution this grant covers | +| mode | Explicit observe or enforce; legacy unmanaged state is not enforcement | +| target rules | Typed hostname/IP/CIDR, port and protocol permissions | +| address constraints | Permitted/denied final destination addresses and approved pins | +| request constraints | Optional HTTP method/path rules with declared parsing semantics | +| infrastructure grants | Narrow operational services, separate from target authorization | +| indirect-action grants | Approved remote actions/secondary scope where expressible | +| provenance | Operator/approval reference, creation and expiration, revocation state | +| required capabilities | What the selected runner/gateway must demonstrably enforce | +| budgets and stop policy | Task/run resource limits, aggregation, enforcement owner and authorized resumption | + +Policy rules: + +1. Explicit deny wins. In enforce mode missing/empty target permissions deny + target access; they do not mean unrestricted access. +2. Scope is operator-owned. Judge/model/target content cannot widen it. +3. Domain authorization and destination-address constraints are separate. Exact + labels, suffix boundaries, IDNA, trailing dots, IPv4/IPv6, ports and protocol + defaults need documented semantics and table-driven tests. Preserve existing + rule behavior until an explicit migration; do not silently convert URL + substring rules into canonical path authorization. +4. Check the final dial address, not just the DNS answer used during approval. + New DNS answers, connections and redirect hops are reevaluated. A permitted + domain does not automatically authorize an excluded IP. +5. Parent proxies that resolve the destination must enforce equivalent address + policy. Strict IP-sensitive policies fail if that capability is unavailable; + hostname-only routing must not be advertised as pinned-IP enforcement. +6. Reevaluate requests on reused HTTP connections. Revocation stops affected + executions and connections, including persistent tunnels, within a documented + bounded interval. Connection pools cannot outlive authorization unnoticed. +7. Path constraints require HTTP visibility. An opaque TLS/SOCKS tunnel can only + claim the constraints actually enforced. If a required path constraint is not + observable, refuse that profile or require an explicit changed policy. +8. Scope approval is necessary but not sufficient to approve an operation: + destructive behavior, data handling and indirect actions retain their own + rules/judge/operator checks. + +DNS resolution and package/recon/callback endpoints require explicit operational +grants. LLM provider and server database credentials remain outside the tool +sandbox. An infrastructure grant must not become general testing authorization +or unrestricted CONNECT access. + +### Resource budgets and enforcement ownership + +| Budget | Enforcement owner | +| --- | --- | +| Requests, network bytes, connection/redirect limits | Managed egress gateway, including persistent streams | +| Process count, CPU/memory, wall-clock, output/download/workspace size | Runner supervisor with supported OS accounting/limits and I/O controls | +| Model tokens/cost, tool steps and overall investigation time | Trusted ARTEX scheduler/control plane | + +Account for children and aggregate simultaneous workers at task level; per-process +limits alone may not bound a whole task. Configure documented thresholds, bounded +overshoot and actions. A strict profile must not advertise a required quota it +cannot enforce. Cancellation/stop closes execution sessions, terminates children +and prevents new scheduling rather than simply returning a warning to the model. +Persist budget configuration, observed usage, enforcement authority, stop reason +and authorized resumption as audit events. bubblewrap is not assumed to supply these +limits; capability tests determine which supervisor/OS mechanisms are required. + +## Runner and gateway contracts + +A managed runner receives executable/argv, working directory, filtered environment, +filesystem permissions, limits, cancellation, a policy reference and an opaque +server-created session binding. Shell parsing remains explicit for shell tools. +The runner returns execution lifecycle events, exit status and capability/coverage +details. Policy transport must not put secrets in argv or tool output. + +Start with Linux shells, custom command tools and task-scoped local MCP processes. +Preserve existing privilege dropping. Restrict filesystem reads explicitly: +wrapping a command does not automatically conceal every server secret. Keep runtime +configuration read-only to the child; allow only task workspaces and necessary +runtime paths. Do not expose broad IPC, host Docker sockets or shared task secrets. + +The gateway authenticates execution sessions before accepting requests. It resolves +policy from a server-side binding rather than trusting a task ID header. Prefer +per-run protected endpoints/credentials; demonstrate isolation between concurrent +tasks, including sibling processes. A long-lived MCP process can be attributed to +a run, but attributing individual concurrent requests to tool calls requires an +actual correlation mechanism. Otherwise label attribution ambiguous. + +If containment, policy lookup or required audit durability fails, enforce mode +does not start new work. Never retry unsandboxed automatically. Cancellation and +revocation terminate the whole managed process tree and close its sessions. + +### Selected Linux backend: ARTEX-owned Go/bubblewrap adapter + +Implement a narrowly scoped Go supervisor invoking a supported external `bwrap` +binary. Do not fork bubblewrap, reimplement kernel isolation, or add a Node/SRT or +Fence dependency for this backend. Existing Node-dependent tools remain unaffected. +The detailed [backend plan](bubblewrap-backend-plan.md) defines responsibilities, +qualification gates and the incremental PRs. + +The choice follows ARTEX's need for one policy authority, task-bound provenance, +explicit failure behavior and complete cancellation. It is not based only on +language alignment or the presence/absence of Node on one host. A higher-level +runtime can save compatibility work, but still needs adaptation to those contracts. +ARTEX accepts responsibility for this adapter's security regressions and supported +Linux matrix; a thin adapter is not automatically a secure sandbox. + +The Go supervisor constructs structured argv and an explicit environment, validates +trusted executable/mount paths, prepares private workspaces and resource domains, +and owns the full process/bridge lifecycle. Preserve existing privilege dropping; +do not expose controller credentials, unintended file descriptors, host home/root +trees or broad IPC sockets. Read-only access to a secret still discloses it. +Test path/symlink races and cross-task access, not only path normalization. + +The managed Linux profile requires separate network and PID namespaces. A protected +task-private bridge exposes only the authenticated ARTEX gateway. All permitted +target traffic also goes through that gateway; it owns destination policy, final +dial, pacing, metadata and optional TLS capture. Environment proxy variables alone +do not enforce containment. Missing namespaces or required resource mechanisms +reject the strict profile; never silently remove isolation to make a tool work. + +Resource enforcement must cover descendants before untrusted code runs. Validate +cgroup v2 delegation or another demonstrated host mechanism plus output/storage +limits; launching and moving a process into limits afterwards leaves a race. +Cancellation/revocation stops the process tree and existing streams, including +CONNECT tunnels. Killing only the direct child or closing only a proxy listener +does not establish whole-task cleanup. Record bounded cleanup and quota overshoot. + +### Dependency acceptance and maintenance + +The [review of PR #555](https://github.com/BaaRai/ARTEX/pull/555#issuecomment-7193053269) +raised the proposed Node-based research-preview dependency. The selected Linux +plan no longer introduces that dependency. Design acceptance still does not qualify +the new backend: implementation PRs need supported bwrap/kernel/distro/container +combinations, reproducible package/artifact provenance, capability tests, +license/SBOM review, measured overhead, diagnostic behavior and named maintenance +and rollback ownership before merge. + +Bubblewrap's [v0.13.1 security model](https://github.com/containers/bubblewrap/blob/v0.13.1/README.md#sandbox-security) +assigns policy and argument-selection responsibility to its caller. This is a +documentation reference, not a chosen minimum runtime version. Track upstream and +distro security fixes, qualify updates and reject incompatible versions/capabilities. +No task-time installation or automatic fallback to unsandboxed execution is allowed. +Independent audit/search work does not require an installed execution backend. + +### Upstream distribution and migration contract + +This targets all upstream ARTEX distributions. At the focused baseline, the +[Docker runtime](https://github.com/BaaRai/ARTEX/blob/e5c7bfcbdd893db26c08f0b004e0169b4ab6ca85/Dockerfile) +installs Node 22.23.4, while [Go ZIPs](https://github.com/BaaRai/ARTEX/blob/e5c7bfcbdd893db26c08f0b004e0169b4ab6ca85/build.sh) +embed the static UI without Node. Neither fact changes the selected backend's +dependency contract. Do not remove dependencies required by existing tools. + +- Preserve Linux amd64/arm64, macOS amd64/arm64 and Windows amd64 release builds + and both Linux container architectures. A build target is not a sandbox guarantee. +- Begin with an explicitly selected optional Go/bwrap backend. Preserve existing + startup safety checks; existing degraded operation is not strict containment. +- PR 4 includes installation/preflight, Linux packaging and host qualification + with the backend. Pin supported packages/artifacts and protect + binaries/helpers/config from task writes and task-controlled PATH. +- Version any bridge/helper protocol and capabilities, including cancellation, + exit and error semantics. Test missing/old bwrap, unavailable user/network + namespaces, absent resource delegation, helper crashes, upgrades and rollback. +- Retain container `no-new-privileges`, execution identities and credential + boundaries. Do not require blanket privileged containers or relax existing host + protections to obtain passing results. +- Each implementation PR includes its dependency provenance/SBOM changes, basic + measurements and update/rollback ownership. No separate release-consolidation PR + is required. Rollback stops incompatible tasks and retains audit history. + +No deployment-specific address, path or credential becomes an upstream default. +Clean-platform tests, not one deployed host, determine support claims. + +### Alternatives retained for future profiles + +The [runtime ecosystem evaluation](sandbox-runtime-evaluation.md) records SRT, +Fence/other Go wrappers, MXC, gVisor, OCI/VM runtimes and execution platforms as +alternatives. They are not dependencies of the selected Linux backend. A future +adapter needs the same Runner/gateway/qualification contract; stronger hostile-code +profiles can evaluate gVisor or VMs separately. Keep the implementation narrow; +reconsider a full runtime if arbitrary-tool compatibility dominates maintenance. +Go-based does not imply native Windows support or zero runtime dependencies. + +### Portability contract: Linux, Windows and macOS + +Preserve ARTEX's application portability independently of runner availability. +Keep public policy, audit and runner APIs free of unconditional Linux imports, +syscalls and shell assumptions. Use platform adapters/build constraints or a +versioned helper protocol. Optional runtime installation must not become a +requirement for unrelated management/audit operations, subject to existing server +security startup checks; this is not permission to bypass an isolation self-test. + +| Environment | Planned execution path | Support claim required | +| --- | --- | --- | +| Linux native | ARTEX-owned Go/bwrap backend; stronger profiles evaluated separately | Pinned backend, effective containment, task separation and tool tests | +| Windows native | Follow-up: separately select a native adapter; unsupported for first-release strict execution | Actual OS build, ACL/token/process-tree/network and tool tests; no Linux-equivalence claim from API compatibility | +| Windows host with Linux VM/WSL2 | Follow-up explicit Linux executor profile | Linux guest tools only; host mounts, interoperability, networking and quotas independently tested | +| Windows controller with remote Linux executor | Follow-up authenticated runner connection | Policy/session binding, workspace transfer, audit delivery, revocation and outage tests | +| macOS | Keep the portable contract; test a separate backend before support claims | No assumption that Linux/Windows tests establish macOS enforcement | + +SRT v0.0.83 packages Windows x64/ARM64 helpers but labels Windows alpha. Its +documented native Windows network residuals and shared-machine limitations mean +that successful initialization alone cannot qualify it for strict adversarial +execution. Reject a profile when required guarantees are not met; a warning or +working HTTP proxy is insufficient. SRT's experimental MXC integration needs its +own capability tests. A Linux guest on Windows does not run native Windows tools. + +At the focused upstream baseline, `server/isolation_other.go` reports unsupported +non-Unix isolation; startup in `cmd/artex/main.go` exposes degraded operation where +applicable. A Windows ZIP does not establish strict Windows isolation. New adapters +must integrate with that startup/isolation state, not create a conflicting status. + +Before dispatch, report backend/version, host and guest OS/architecture, effective +capabilities, required privileges and limitations. If none qualifies, reject the +strict execution with an actionable reason; never automatically run it on the +host. Explicit remote dispatch is a different deployment profile, not a hidden +fallback. Report local versus remote evidence accordingly. + +CI must preserve all five release builds and run portable contract tests on the +supported operating systems. macOS containment needs real-host acceptance before +it is advertised. Native Windows acceptance additionally needs a real Windows +runner: PowerShell/cmd and native executables, path quoting/Unicode, ACL and reparse +point handling, child cleanup/cancellation, environment/credential isolation, +proxy/TLS behavior, task separation, revocation, resources and backend absence. +Cross-compilation and mocked tests alone cannot establish runtime containment. + +## Audit event contract + +Proposed metadata is append-oriented and independent of request/response body +retention. Use idempotent event IDs and distinct attempt IDs. + +| Group | Proposed fields | +| --- | --- | +| Identity | event ID, attempt/connection ID, parent retry/redirect reference | +| Time | observed-at, received-at, source clock/precision | +| Execution | task, exploration, intent, run, tool-call, runner/session IDs | +| Attribution | trusted source and confidence: exact, run-only, ambiguous, unknown | +| Actors | initiator, executor and approver references, when known | +| Policy | policy revision/digest, rule and approval IDs, verdict and reason | +| Destination | host, actual IP/port when known, protocol, method and URL when visible | +| Observation | stage, local/upstream outcome origin, error, timing and known bytes | +| Evidence | capture/archive references, source kind and integrity metadata | +| Coverage | visibility level, backend/version, host/guest platform and capability manifest, related gap references | +| Assessment | referenced observations/artifacts, rule/model/operator source and version, rationale, contradictions and disposition | +| Resource control | budget revision, measured usage, limit/stop reason, enforcement owner and authorized resume reference | + +Observation stages distinguish declared intent, policy decision, connect attempt, +connection established, request forwarded, response headers observed, stream +completion/failure and imported evidence. A response-header hook is not a completion +event. Unknown fields stay null; no synthetic success status. + +A gateway denial and a target response are different outcomes even if both use HTTP +403. Direct socket attempts blocked by OS containment might not produce a +per-destination proxy event; do not claim complete denied-attempt detail if the +runtime offers only an execution error. Record that coverage limit. + +Raw and normalized URL forms are separate. Safe display/search redacts userinfo, +sensitive query values and configured headers. Raw evidence is separately +authorized; access and exports are audited. URL normalization for search never +changes request bytes or policy meaning. Preserve original/rewritten request +references when capture rules intentionally mutate traffic. + +Retries and redirects use new attempt IDs. Historic capture imports preserve the +source timestamp and add ingestion time/provenance. Transcript matches are +investigation candidates, not retroactively created network events. + +Deception assessments are separate events referencing observations, not edits that +turn a target claim into a verified fact. Record uncertainty and later corrections; +the underlying observed request remains unchanged. Artifact references and hashes +identify evidence without requiring unsafe preview or execution. Suspected secrets +and honeytokens follow the same redaction/access policy as other sensitive evidence. +Retain stop/pause/resume history through archive and restart; do not fabricate +fine-grained OS violation details when the sensor reports only an execution error. + +### Storage and failure semantics + +Start by evaluating PostgreSQL metadata alongside existing task data, referencing +the current traffic store for optional bodies. Benchmark before adding another +storage service. Index time, destination and execution identifiers; substring +search needs a bounded index/query design rather than unbounded scans. + +Use a bounded durable spool, idempotent ingestion, explicit backpressure and health +events. If neither storage nor spool can accept required records, strict audited +execution stops accepting new work. An outage has a recorded coverage interval, +not an unexplained hole. Payload truncation/body recording failure must not be +confused with successful full capture. + +Retention is configurable and distinct for metadata and bodies. Task archive/delete +does not silently erase the incident trail: retain audit references/tombstones for +the retention period and expose authorized archive lookup. Administrative deletion +and redaction remain explicit audited operations. Append-oriented storage is not +a claim of cryptographic tamper resistance. + +## Operator workflow + +Search by URL/domain/IP/path fragment and time window/timezone. Support exact host +and URL versus substring, method, outcome/status, task/run and visibility filters. +Use bounded keyset pagination. + +Each result explains what matched and what was observed. The timeline links the +execution, decision/approval, retry/redirect chain, capture and remote evidence. +Searching or opening evidence must not make a new target request. + +Coverage accompanies results: full HTTP visibility, opaque connection metadata, +remote/unmanaged execution, recorder outage or archived-only evidence. “No matching +observed access” is appropriate when evidence is incomplete; “never accessed” is +not. A shared login does not support named-human attribution. + +The first release links available observations, policy/budget stops and existing +operator decisions. The following richer workflow is a follow-up, not a requirement +to build an automated deception engine in PR 2 or PR 4. + +For suspected deception, show target claims, actual observations, corroboration, +contradictions, judge/operator assessments and resource-limit events separately. +Link a proposed action to its inducing content when correlation is available; mark +unknown/ambiguous correlation rather than inferring causation. Operators can record +a false-positive disposition or authorize a revised budget/policy without erasing +the original evidence. Investigation UI actions must not silently execute artifacts, +test discovered credentials or initiate further probes. + +## Compatibility and cost + +| Surface | Initial treatment / acceptance boundary | +| --- | --- | +| Linux shell and children | Managed only after containment and bypass-resistance tests | +| Local MCP | Task/run-owned sessions first; concurrent tool-call provenance tested | +| Native Go HTTP | Policy and audit instrumentation required independently of the process sandbox | +| HTTP and redirected HTTP | Per-request policy and attempt chain | +| HTTPS with capture | Explicit trust/inspection profile; preserve existing capture behavior | +| Pinned TLS or mTLS | Opaque or unsupported profile; no invented URL/path visibility | +| SOCKS/raw TCP | Destination-level policy; no universal HTTP semantics | +| UDP, ICMP, raw SYN, QUIC | Separate capability/runner work; strict unsupported profiles fail | +| Remote MCP, VM, container, Android | Separate enrollment and evidence; local wrapping is insufficient | +| Parent proxy | Final-hop address enforcement must be demonstrated | +| Native Windows | Follow-up beyond the first release; preserve builds and reject unqualified strict profiles | +| Windows with Linux VM/WSL2, remote executors and nested containers | Explicit profiles with independent tests; distinguish host OS from guest/tool OS | +| macOS | Preserve portability and publish separate tests before claiming parity | + +TLS interception changes trust and may affect signed or intentionally unusual +requests. Preserve raw targets and expose ambiguous parsing. Do not normalize test +traffic silently. WebSocket/SSE streams need lifecycle events and resource limits, +not endless body buffering. Avoid automatically broadening privileges or enabling +all Unix sockets to make a tool work. + +Measure runner startup, CPU/memory, throughput/p95 latency, spool capacity, metadata +and payload storage growth, query p50/p95 and concurrent attribution. Illustrative +only: one million 1 KB metadata records is approximately 1 GB before indexes and +replication; 50 KB bodies per request add approximately 50 GB. Retention defaults +must follow measured workload and operator needs. + +Deception-resilience controls also cost review time, accounting overhead and +evidence storage. Measure false positives on benign controls, lost useful work, +stop latency and budget overshoot. Stronger isolation for high-risk artifact +execution is a separate runner profile; this proposal makes no VM-level isolation +claim for a shared-kernel sandbox. + +## Delivery sequence and exit gates + +Four PRs total, including this existing design PR; only three new implementation +PRs follow. Group by independently useful outcomes rather than internal layers. + +| PR | Deliverable | Dependencies | Exit criterion | +| --- | --- | --- | --- | +| 1 | Existing design PR #555: scope, policy/audit/Runner contracts and support boundaries | — | Agree the bounded first release; documentation only, no new runtime dependency or default | +| 2 | Searchable access audit end to end: trusted access/content provenance, existing producers, URL/time API and minimal inert evidence UI | 1 | Trace a synthetic URL to its task/tool and outcome with body capture off; truthful gaps, redaction, restart/spool-full, retention/archive references and query limits | +| 3 | Authoritative gateway and action authorization: scope, network budgets, existing judge/approval and untrusted-content boundaries | 1, 2 | Final-dial/DNS/redirect/revocation and deny precedence; trusted sessions and secondary-target checks; remote-content framing/summary propagation and independent action-authorization regressions; coverage limited to enrolled paths | +| 4 | Complete opt-in Go/bwrap Linux backend: process/filesystem isolation, private gateway bridge, resource enforcement, packaging and qualification | 2, 3 | No direct-egress bypass; pre-exec descendant/task limits; complete process/tunnel cleanup; supported amd64/arm64 host/container tests, install/absence diagnostics, basic overhead/security fixtures and rollback; unsupported profiles fail closed | + +### First-release scope and explicit follow-ups + +The first release is a usable Linux audit-and-enforcement path, not the entire +sandbox ecosystem roadmap. PR 2 provides immediate investigation value on existing +managed producers, without waiting for bwrap. PR 3 enforces enrolled transports; +it must not claim confinement of arbitrary host processes before PR 4. PR 4 is +enabled opt-in only after its combined isolation, gateway, cleanup, resource and +platform acceptance passes. + +Keep all five controller release builds and preserve existing security startup +checks. Native Windows/macOS sandbox implementations and new managed Linux-guest/ +remote-executor deployments are follow-ups, not hidden subprojects in PR 4. Until +qualified, those strict local profiles report unsupported; no host fallback. +Raw/UDP/ICMP/QUIC, general browser/nested-container compatibility and stronger +VM/gVisor profiles are also outside the initial declared tool matrix. + +First-release deception resilience consists of containment, trusted evidence links, +budget stops and reuse of existing judge/operator approvals. Known secondary +destinations receive deterministic scope checks; uncertain indirect actions still +require existing review/denial, and hard denies cannot be overridden. New automated +deception classifiers, generalized evidence-corroboration engines, rich investigation +workflows and suspicion-triggered pause/resume automation are follow-ups. No +honeypot-detection, anonymity or remote-second-hop containment claim is introduced. + +Remote-content prompt-injection defense is explicitly in the first release: +trusted provenance in PR 2, existing input-boundary/action-authorization integration +in PR 3, and hard execution containment in PR 4. It is distinct from deferred +automatic deception classification. See the ADR for ingestion, summary/memory and +synthetic-fixture requirements. + +Tests, deployment diagnostics, dependency provenance/SBOM updates, basic overhead +measurements and rollback belong to the PR that introduces the behavior. There is +no separate packaging or benchmark PR. Advanced cross-platform/fleet benchmarks +and richer analytics can follow; required security tests cannot be deferred. + +Use a reviewable commit series and checklist inside PR 4 for supervisor/filesystem, +gateway transport and resources/packaging. Do not ship partial containment as a +strict profile. Each PR needs its actual tests, diagnostics and rollback; retain +the repository's open-PR limit and review changes incrementally. + +Use synthetic targets and authoritative test DNS. Cover allowed/denied domain and +port, CIDR/IPv6, changed DNS, disallowed redirects, hostname/IP mismatch, invalid +provenance, simultaneous tasks, child processes, removed proxy environment, native +HTTP, parent proxies, TLS pinning/mTLS, opaque protocols, unavailable namespaces, +gateway/bridge failures, full spool, supervisor restart, cancellation and revocation +of already established tunnels. Test filesystem races, descriptor leaks, pre-exec +resource limits, descendant cleanup and aggregate quota exhaustion. A mock A-to-B +server-side request demonstrates the remote trust boundary without operational +exploit payloads. Preserve capture/rewrite/archive/noise-governor regressions. + +Deception-resilience fixtures use synthetic services, inert artifacts and fake +credentials: content inducing a denied file read or destination; a fabricated +success claim; bounded crawl/output/download/resource traps; cross-workspace +attempts by two workers; and benign unusual responses. Assert actual enforcement, +aggregate budgets, stop latency/overshoot and auditable review/resumption, without +automatic confirmed-honeypot classification. Put each fixture in the PR introducing +its control; evidence of required protections is not deferred to a later PR. + +## Rollout and open decisions + +First release is opt-in for a controlled Linux task set. Observe mode helps +compatibility evaluation but cannot certify future enforce-mode support. Required +capabilities are checked before task start. Any default change is a separate +reviewed decision. + +Migrations remain additive. Rollback stops affected managed tasks and restores +compatible components; it does not silently resume them outside the sandbox or +delete audit history. + +Resolve during implementation reviews: + +- Which protected bridge/helper topology and supported bwrap versions satisfy + task authentication, forced egress, cleanup and deployment requirements? +- Which cgroup/delegation and storage mechanisms enforce required limits before + untrusted execution across the declared host/container support matrix? +- Which execution surfaces can satisfy per-run and per-tool-call attribution + without unacceptable MCP startup overhead? +- Which scope syntax/migration and URL ambiguity semantics should be exposed? +- What revocation bound and durable-spool behavior can the implementation meet? +- Which TLS/non-HTTP profiles are initially supported, and which require a + separate executor? +- What retention and performance targets follow from benchmark measurements? +- Which Windows backend and OS builds meet strict-mode requirements, and which + operations must use explicitly selected Linux-guest/remote profiles? +- Which aggregate budgets and suspicion-to-pause policy preserve useful work + while containing deceptive workloads? + +## Pre-submission verification gate + +Run relevant checks in an isolated checkout on the designated Linux verification +host before committing/submitting each revision. Record the tested base plus exact +working-tree content, environment, commands, outcomes and skips. A documentation +revision uses document/link/plan checks and any relevant existing regressions; +that is not a sandbox implementation test. Implementation PRs require actual +functional and isolation acceptance before submission. A failed or unavailable +required check blocks submission; CI and one-host success do not replace the wider +supported OS/architecture/container qualification. Keep production deployments and +their configuration untouched by the verification checkout. diff --git a/docs/sandbox-runtime-evaluation.md b/docs/sandbox-runtime-evaluation.md new file mode 100644 index 000000000..06f28fd28 --- /dev/null +++ b/docs/sandbox-runtime-evaluation.md @@ -0,0 +1,163 @@ +# Sandbox runtime ecosystem evaluation + +Research record and revised direction, 2026-11-27: ARTEX-owned Go/bubblewrap for Linux. +Candidate containment remains unqualified; this is not a runtime test report. +Companion: [managed execution design](managed-execution-scope-and-audit.md). + +## Evidence and scope + +This review checked official documentation, repository files, release metadata and +the published SRT npm archive. It did not execute containment tests on any candidate +or on a Windows host. Source availability, package contents and a passing build do +not establish a security guarantee. + +The npm `latest` version checked was `@anthropic-ai/sandbox-runtime@0.0.83`. +Its archive matched the registry SHA-512 integrity value and contained x64/ARM64 +`srt-win.exe` helpers and distributed configuration/proxy code for the features +discussed below. The package declares Node >=22.12.0. Archive inspection is not +runtime qualification. + +Official release metadata checked: SRT v0.0.83, MXC v1.1.0, OpenShell v0.1.10, +nono v0.82.0, microsandbox v0.8.3, OpenSandbox release-1.2.1, and Kubernetes +agent-sandbox v1.0.12. Other feature observations may describe main/development +documentation; the implementation must repeat checks against its selected artifact. + +## Four different portability claims + +1. The ARTEX controller compiles/runs on the host. +2. An SDK/client can contact a sandbox service from that host. +3. A local backend creates an execution boundary on that host. +4. The sandbox can execute the required guest OS tools. + +A Go SDK does not imply a Go runtime or native Windows execution. A Linux VM on +Windows runs Linux workloads; it does not establish a boundary around arbitrary +Windows executables. Language choice is not an isolation primitive. + +## SRT: cross-platform, with different guarantees + +[SRT v0.0.83](https://github.com/anthropics/sandbox-runtime/blob/v0.0.83/README.md) +uses Linux bubblewrap/network namespaces, macOS Seatbelt, and an alpha Windows +backend using a dedicated account, restricted tokens and WFP. Its Windows helpers +are present in the released npm package. + +The Windows documentation discloses network residuals involving identity changes +and service-mediated operations, plus shared-machine and tool compatibility limits. +Some residuals are warnings rather than initialization failures. Consequently, +that backend must not qualify for ARTEX strict adversarial execution merely because +it starts successfully. The experimental MXC integration is a separate capability +profile with its own host and tool requirements. + +SRT's [configuration source](https://github.com/anthropics/sandbox-runtime/blob/0bbebed0aa9a8e628dc4df8bc30293550a1988eb/src/sandbox/sandbox-config.ts) +offers domain/port policy, strict allowlists, resolved-address restrictions and +proxy integration. ARTEX still owns task policy translation, final-hop enforcement, +audit provenance, budgets and incident search. HTTPS path policy requires plaintext +visibility or TLS inspection; upstream proxy resolution needs its own enforcement. +Avoid duplicate TLS interception. + +Node costs must be evaluated across upstream distributions, not one installed host. +At ARTEX main `e5c7bfcbdd893db26c08f0b004e0169b4ab6ca85`, the Docker runtime installs +Node 22.23.4, but release ZIPs do not bundle Node and serve a statically embedded UI. +See the [distribution contract](managed-execution-scope-and-audit.md#upstream-distribution-and-migration-contract) +and [backend plan](bubblewrap-backend-plan.md) for packaging and acceptance requirements. +Neither a frontend build nor one deployment establishes a universal prerequisite. + +## Ecosystem map + +| Layer / candidate | Execution boundary and platform | Go relationship | ARTEX fit and limit | +| --- | --- | --- | --- | +| [SRT](https://github.com/anthropics/sandbox-runtime) | Native process restrictions; Linux/macOS, Windows alpha | Invoke a Node helper/CLI from Go | Evaluated alternative, not selected for the initial Linux backend; Windows needs separate qualification | +| [Microsoft MXC](https://github.com/microsoft/mxc/tree/v1.1.0) | OS-specific process/session/VM backends across Windows/Linux/macOS | Rust/.NET/Node SDKs; JSON executor interface usable from Go | Important native Windows candidate; exact OS build and backend capability matter | +| [nono](https://github.com/nolabs-ai/nono) | Linux Landlock, macOS Seatbelt; Windows through WSL2 | Rust implementation; verify official binding coverage rather than third-party SDK lists | Similar policy/credential/audit concerns; WSL2 is not native Windows | +| [bubblewrap](https://github.com/containers/bubblewrap), [runc](https://github.com/opencontainers/runc) | Linux namespace/container primitives | runc is Go; bwrap is an external primitive for a Go supervisor | Useful foundation, not a complete per-task policy/audit product | +| [Fence](https://github.com/fencesandbox/fence) | Go runtime over Linux bwrap and macOS Seatbelt | Public Go package plus CLI/helper lifecycle | Reference/alternative; its library, proxy and resource-limit contracts still require ARTEX integration; no native Windows guarantee | +| [exec-sandbox](https://github.com/tkdtaylor/exec-sandbox), [flar](https://github.com/swelljoe/flar) | Go launchers over Linux bwrap and/or gVisor | Go implementations | Relevant examples; independently verify security, release maintenance and credential/approval defaults | +| [gVisor/runsc](https://gvisor.dev/docs/) | Linux application kernel / OCI runtime | Go implementation; separate Go SDK exists | Candidate stronger-isolation profile; syscall compatibility and overhead need tests | +| [Firecracker](https://github.com/firecracker-microvm/firecracker), [Kata](https://github.com/kata-containers/kata-containers) | VM boundary and Linux/container integration | Firecracker is an external VMM; Kata has Go/Rust components | More guest/image/network lifecycle work; no built-in ARTEX URL audit | +| [microsandbox](https://github.com/superradcompany/microsandbox) | Linux guests on Linux KVM, macOS Apple Silicon and Windows WHP | Go SDK plus native runtime/FFI assets | Cross-host microVM candidate; beta, and a Windows host still does not imply Windows guests | +| [Windows Sandbox](https://learn.microsoft.com/en-us/windows/security/application-security/application-isolation/windows-sandbox/) | Disposable Windows VM | OS feature, not a Go library | Native Windows workload isolation; edition, lifecycle, concurrency and network mediation constraints | +| [OpenShell](https://github.com/ai-openshell/openshell) | Policy/supervisor platform with several compute drivers | Go SDK to its gateway, not a pure-Go sandbox | Rich controls but greater integration surface; native Windows has a separate unqualified development path | +| [OpenSandbox](https://github.com/opensandbox-group/OpenSandbox/blob/main/docs/architecture/index.md) | Lifecycle platform over Docker/Kubernetes and other providers | Python control plane, Go execd and Go SDK | Useful for pooled/remote execution; guarantees depend on runtime and network configuration | +| [Kubernetes agent-sandbox](https://github.com/kubernetes-sigs/agent-sandbox) | CRD/controller orchestration; delegates isolation via RuntimeClass | Go controller/client ecosystem | Relevant if ARTEX adopts Kubernetes; not an isolation engine itself | +| [E2B Runtime](https://github.com/e2b-dev/runtime) | Linux/KVM Firecracker execution platform, hosted or self-operated | Go backend around an external VMM | Full remote execution stack; heavier than wrapping local commands | +| [Daytona](https://www.daytona.io/docs/en/sandboxes/) | Service with different workload classes, including Windows VMs | Client SDK support, including Go | Service evaluation distinct from embedding a runtime; old public core repository is unmaintained | +| [Wasmtime](https://docs.wasmtime.dev/security.html) | WebAssembly capability boundary | Embed/invoke a Wasm runtime | Useful for constrained plugins, not a drop-in boundary for arbitrary native tools | + +The gVisor [Go SDK quickstart](https://gvisor.dev/docs/sdk/go/quickstart/) explicitly +labels that SDK experimental and not intended for production. Do not transfer +runsc's maturity to its newer API. + +MXC v1.1.0 lists Rust/.NET/Node SDKs and JSON executors. Its +[Windows build requirements](https://github.com/microsoft/mxc/blob/v1.1.0/docs/backends/process-container/os-version-support.md) +vary by process/session backend; a generic Windows 10/11 label is insufficient. + +OpenShell's [Windows guide](https://github.com/ai-openshell/openshell/blob/main/WINDOWS.md) +points to a separate branch and explicitly says the implementation is not a +production-qualified security boundary. Its main stable release assets are not +that native Windows distribution. + +nono's [WSL2 documentation](https://www.nono.sh/os-sandbox) describes conditional +kernel capabilities. Query actual ABI/feature support; do not assume all WSL2 +installations have the same kernel or proxy enforcement. + +Daytona's [old repository notice](https://github.com/daytonaio/daytona) says core +development moved to a private codebase and that repository receives no further +fixes/releases. Current cloud capabilities do not imply equivalent maintained +self-hosted source. + +## Selected implementation direction for ARTEX + +Implement the narrowly scoped [ARTEX-owned Go/bwrap Linux backend](bubblewrap-backend-plan.md) +behind portable Runner and authoritative gateway contracts. Use upstream bwrap +as an external primitive; do not fork it or reimplement kernel isolation. No +Node/SRT/Fence dependency is introduced by this backend. Existing Node-dependent +tools retain their requirements. This direction prioritizes the fit to ARTEX's +task attribution, policy and lifecycle, not language alignment alone. + +ARTEX owns launch/mount policy, gateway transport, complete cleanup, resource +enforcement, packaging and the supported Linux matrix. Keep that scope explicit; +small code size is not proof of security. The first release uses four PRs total: +existing design, usable audit/search, authoritative gateway, and one complete +Linux backend. Supervisor, bridge and resource qualification are reviewable commits +inside that backend PR, not additional PRs. Native Windows/macOS, new managed +guest/remote profiles and advanced automated investigation remain follow-ups. +No candidate has completed ARTEX runtime acceptance. + +SRT and Go wrappers remain references or future adapter options. Evaluate native +Windows options independently and consider gVisor or VM profiles when a stronger +boundary is required. The Linux choice establishes no native Windows/macOS +containment guarantee and preserves all existing ARTEX build targets. + +For Windows, expose native execution, explicit Linux guest and remote Linux +profiles separately. Absence of a qualifying backend rejects strict execution; +it must not break unrelated management/audit solely because an optional dependency +is missing, nor weaken existing security startup checks. + +Do not add a fleet platform merely to sandbox a local command. Conversely, if +execution pools, snapshots and remote scheduling become requirements, compare +OpenSandbox, agent-sandbox and E2B as platforms rather than rewriting those services. + +## Acceptance before selecting a backend + +The integration targets upstream mergeability. Backend PRs need reproducible +installation, missing-dependency behavior, protocol compatibility and upgrade/ +rollback tests immediately; final release consolidation is a later milestone. +Use existing upstream budget accounting and isolation status rather than parallel +implementations. One host's installed Node or a cross-compiled Windows ZIP cannot +establish the product's runtime requirements or containment guarantees. + +- Pin version/artifact and record platform/capabilities; test installation, absence, + upgrade and rollback without insecure fallback. +- Test filesystem/IPC/credential isolation and per-run separation, including + children and long-lived MCP sessions. +- Test final-dial destination policy, DNS changes, redirects, IPv6, upstream proxies, + TLS/mTLS/pinning, opaque protocols and policy revocation. +- Test Windows native tools and paths on real Windows; separately test guest/host + mounts, interoperability and network behavior for VM/WSL profiles. +- Measure startup, CPU/memory/I/O, concurrent throughput and tail latency on the + actual ARTEX tool set, including browsers, parsers and scanners. +- Test durable attribution, capture-off metadata, budget/stop behavior and deceptive + versus benign fixtures. No honeypot detection, anonymity or remote RCE containment + guarantee follows merely from choosing a sandbox. + +No installation, rollout or Windows security qualification was performed in this +research. The design selects a direction; implementation PRs must provide the actual qualification evidence.