From f222d920b6a116b7e967cc7c92d9992ec8e6d2b1 Mon Sep 17 00:00:00 2001 From: renaesop <5894477+renaesop@users.noreply.github.com> Date: Wed, 2 Dec 2026 08:32:07 +0800 Subject: [PATCH] docs: reconcile execution and audit design with upstream Docker backend --- docs/bubblewrap-backend-plan.md | 127 +++++++++ docs/managed-execution-scope-and-audit.md | 329 ++++++++++++++++++++++ docs/sandbox-runtime-evaluation.md | 99 +++++++ 3 files changed, 555 insertions(+) create mode 100644 docs/bubblewrap-backend-plan.md create mode 100644 docs/managed-execution-scope-and-audit.md create mode 100644 docs/sandbox-runtime-evaluation.md diff --git a/docs/bubblewrap-backend-plan.md b/docs/bubblewrap-backend-plan.md new file mode 100644 index 000000000..4c190e0ec --- /dev/null +++ b/docs/bubblewrap-backend-plan.md @@ -0,0 +1,127 @@ +# Execution backend decision: Docker supersedes the bubblewrap plan + +Status: **the former Go/bubblewrap implementation prerequisite is superseded**. +Reconciled 2026-12-02 against main +[`8f91643`](https://github.com/BaaRai/ARTEX/tree/8f91643). +The historical filename is retained so existing PR/issue links keep working. +Companion: [scope/audit design and completion matrix](managed-execution-scope-and-audit.md). + +## Decision + +Use and harden the Docker backend that upstream already ships. Do not introduce +an external `bwrap` binary, a second supervisor/private bridge or a new runtime +selection dependency merely to implement the old plan literally. The requirement +was a managed execution boundary; Docker satisfies substantial parts of it using +a different implementation. It does not automatically satisfy every proposed +policy, audit, action-authorization or platform requirement. + +The earlier plan remains available in +[the previous design revision](https://github.com/renaesop/ARTEX/blob/bd3547a3d65a609a2d5483a3593ce1113f7c8de7/docs/bubblewrap-backend-plan.md). +It is history, not an instruction to replace current Docker defaults. A future +alternative backend requires a concrete unmet need and separate acceptance. + +## Implemented execution boundary + +Main's [Compose configuration](../docker-compose.yml) and +[sandbox mode contract](../sandbox/types.go) default to `ARTEX_SANDBOX=required`. +`off` is an explicit degraded mode with warnings, not a fallback when Docker fails. +The panel authenticates to `artex-runner`; the runner controls Docker via its socket. +The worker receives neither that socket nor the runner's bearer token. + +For each task, [DockerBackend](../sandbox/docker.go) creates: + +- One worker container for that task's command executions, including concurrent + logical workers. It runs as UID/GID 10001, with a read-only root filesystem, + all capabilities dropped, no-new-privileges, a task workspace and bounded tmpfs. + The main baseline mounts the workspace; pending #596 adds only the public CA + bundle as an additional read-only file mount. +- One internal task network. The worker has no general external-network attachment. +- One egress proxy attached to both the internal task network and the egress + network. It enforces approved domain/CIDR scope and pins upstream dials. + Its audit directory is not mounted into the worker. + +Model calls, scheduling, approvals and the logical agent loop remain in the panel. +Panel HTTP/WebFetch use separate task-scope checks. Browser, MCP and file services +must be evaluated by their actual execution path, not declared isolated because +Bash uses Docker. Task-level separation does not make processes within the same +task mutually untrusted peers with private per-run credentials/workspaces. + +## Existing contracts and limits + +| Area | Main implementation | Remaining acceptance boundary | +| --- | --- | --- | +| Runner API | Bearer-authenticated health, exec, kill and delete; structured argv, cwd, filtered environment, timeout and scope fields | This is the actual API in [runner.go](../sandbox/runner.go) and [types.go](../sandbox/types.go), not the old proposed versioned policy/capability/session API. | +| Admission | Required-mode checks fail without a usable runner/Docker; no automatic local execution fallback | Diagnose missing images, credentials, networking and effective host capabilities; startup success alone does not qualify every isolation property. | +| Worker limits | 2 GiB memory, 2 CPUs, PID limit 512; exec output bounded by the runner | Settings are container-level, shared by sibling executions. They are not an end-to-end task network budget or aggregate accounting for panel/MCP work. | +| Proxy limits | 256 MiB memory, 0.5 CPU, PID limit 128 | Attribute proxy costs separately; audit/network saturation and failure behavior still need explicit contracts. | +| Egress | HTTP/CONNECT/SOCKS TCP with scope and final-address checks | Main's CONNECT/SOCKS are opaque. No complete port/protocol/path/explicit-deny policy translation, universal browser/MCP enrollment or immediate live-policy revocation guarantee follows. | +| Evidence | Proxy-owned connection JSONL | Full URL audit, task-proxy credentials, CA mounts and authenticated collection are pending in #596, not in this main baseline. | +| Identity | Task-bound container/network/workspace, filtered execution environment | Independent hostile workers within one task are not separately contained; exact run/tool-call attribution requires additional trusted correlation. | +| Maintenance | Existing runner/worker/proxy images and Go/Docker integration | Continue dependency/image updates, effective-limit tests and compatible rollback. Do not add bwrap package/version qualification as a duplicate release blocker. | + +CPU/memory/PID settings are applied through Docker container creation before +commands execute. The support matrix must still verify that a particular host +actually enforces them. Existing task/intent token, turn and wall-clock budgets +remain authoritative; use their ledger rather than introduce competing accounting. +The larger budget contract is in the [main design](managed-execution-scope-and-audit.md#remaining-policy-and-authorization-contract). + +## Lifecycle work now merged + +[PR #764](https://github.com/BaaRai/ARTEX/pull/764) is merged at this baseline. +It serializes task lifecycle changes, rejects unproven exec completion, removes +the exact worker after timeout/cancellation/failure, preserves replacement workers +from delayed cleanup, and removes workers before deleting their networks. +Failed removal keeps identifiers available for retry. + +Whole-container removal terminates that task's sibling executions too, while +preserving its workspace and leaving other tasks' workers alone. Pause/Kill can +use the UID process scan and retain the proxy/network; the deletion path is a +different operation. Do not turn process cleanup tests into a claim that every +existing proxy tunnel is synchronously revoked by a scope edit. Scope revocation, +long-lived channels and control-plane/policy failure remain explicit test cases. + +Relevant regressions: [exec cleanup](../sandbox/exec_cleanup_test.go), +[concurrency](../sandbox/exec_concurrency_test.go), +[delete/kill retry](../sandbox/docker_cleanup_test.go), +[real Docker containment](../sandbox/docker_e2e_test.go) and +[exec wrapper implementation](../cmd/artex-exec-wrap/main.go). + +## Compatibility and qualification + +Preserve the five controller release targets and the Linux amd64/arm64 container +builds in the [release workflow](../.github/workflows/release.yml). Those are build +contracts, not evidence of native Windows/macOS isolation. Linux containers on a +Desktop/VM/remote daemon execute Linux tools; host sharing, credentials, mounts, +networking, restart/revocation and effective limits need separate tests. + +The earlier cc01 x86_64 Docker results are useful scoped evidence for the tested +branch, not an ARM64/Desktop/fleet certification. A documentation update does not +extend that support matrix. Kernel/VM comparisons and storage quota design are +not expanded in this revision, and no new guarantees in those areas are claimed. + +The network compatibility tradeoff remains explicit: approved destinations can +carry callbacks or data exfiltration even after an injected action is confined. +Docker and URL logging do not promise reverse-shell prevention. Stronger action +or protocol restrictions need separately reviewed policy and compatibility tests. + +For pending #596, deploy matching panel/runner/proxy images and preserve its +per-task public-CA-only mount and independent proxy credentials. Pinning, mTLS and +HTTP/2-only clients cannot use its HTTPS inspection path; SOCKS remains opaque. +Rollback restores compatible components, not unsandboxed execution, and preserves +retained audit data. + +## Remaining work instead of a second backend PR + +1. Reconcile and complete #596's audit/investigation acceptance, including exact + action/artifact and secondary-destination evidence; do not call its Draft code + merged or treat connection metadata as full URL evidence. +2. Extend current scope/gates with the remaining policy, indirect-action, budget, + trusted-provenance and revocation contracts in the main design. +3. Maintain synthetic Linux regressions for missing proxy variables, cross-task + access, failed cleanup, restart, timeout effects on siblings, long-lived + channels, output pressure and effective resource limits. Qualify additional + platforms only with actual platform tests. + +The original four-PR order is retired. Existing Docker implementation and merged +#764 count as delivered work; tests and packaging stay with the behavior they +validate. Do not recreate completed work to preserve planning slot numbers. diff --git a/docs/managed-execution-scope-and-audit.md b/docs/managed-execution-scope-and-audit.md new file mode 100644 index 000000000..1a1a4c7d5 --- /dev/null +++ b/docs/managed-execution-scope-and-audit.md @@ -0,0 +1,329 @@ +# Managed execution scope and access audit + +Status: **partially implemented; Docker is the current execution backend**. +Reconciled on 2026-12-02 against main +[`8f91643`](https://github.com/BaaRai/ARTEX/tree/8f91643). +This PR updates the design and completion assessment only; it changes no runtime +behavior, dependency or default. + +The original 2026-11-27 Go/bubblewrap choice and fixed four-PR delivery order are +superseded. Main already implements task isolation and scoped egress with Docker; +there is no reason to build a second bubblewrap backend to satisfy those same +requirements. **The execution foundation has shipped, but the full audit and +independent action-authorization design has not.** Do not close the feature issues +merely because commands run in containers. + +Tracking: [audit #553](https://github.com/BaaRai/ARTEX/issues/553), +[runtime #554](https://github.com/BaaRai/ARTEX/issues/554), +[design #555](https://github.com/BaaRai/ARTEX/pull/555). +The issue descriptions retain the earlier proposal; the matrix below identifies +what this revision replaces and what remains an acceptance requirement. + +## Completion assessment + +“Main” means code merged at the pinned baseline, not every platform qualified. +“Pending PR” means implemented on a review branch, not available in main. + +| Original requirement | Current status | Evidence and remaining boundary | +| --- | --- | --- | +| Isolated command execution and no silent host fallback | **Main: implemented with Docker** | [agent/sandbox.go](../agent/sandbox.go), [server/sandbox.go](../server/sandbox.go), [sandbox/docker.go](../sandbox/docker.go). `ARTEX_SANDBOX=required` is the default; `off` explicitly degrades isolation. One worker container per task, not per logical worker/run. | +| Private execution network and final-dial scope checks | **Main: implemented for enrolled paths** | [sandbox/policy.go](../sandbox/policy.go), [sandbox/proxy.go](../sandbox/proxy.go), [docker-compose.yml](../docker-compose.yml). Per-task internal network and domain/CIDR proxy; panel HTTP/WebFetch have separate scope checks. This is not the entire proposed policy gateway. | +| Operator scope cannot be widened by agent-discovered assets | **Main: implemented with regression coverage** | [server/sandbox.go](../server/sandbox.go), [scope-drift tests](../server/sandbox_scope_drift_test.go), [company-grant tests](../server/sandbox_company_egress_test.go). Operator-approved scope and approved company snapshots; task intercept allow rules also enter the egress scope. Target-gate approval alone does not widen task egress. | +| Execution failure/timeout cleanup and deletion | **Main: hardened by merged #764** | [PR #764](https://github.com/BaaRai/ARTEX/pull/764), [exec cleanup tests](../sandbox/exec_cleanup_test.go), [concurrency tests](../sandbox/exec_concurrency_test.go). Unprovable completion/timeouts remove the captured worker; Delete removes worker before network and retains failed cleanup state. This does not prove all policy-revocation/tunnel semantics. | +| Process and resource containment | **Main: baseline limits implemented** | Non-root worker, read-only rootfs, dropped capabilities, no-new-privileges, Docker CPU/memory/PID limits and bounded exec output. Whole-task network quotas, accounting across panel/MCP/proxy paths and a complete capability matrix remain open. | +| Connection metadata outside worker control | **Main: implemented** | Proxy-only `egress.jsonl` contains task, host/port, resolved address, decision/protocol and bytes. Main's CONNECT/SOCKS are opaque; these logs are not a full URL index. | +| Capture-independent HTTP(S) URL/time search | **Pending PR #596: implemented, not merged** | [#596](https://github.com/BaaRai/ARTEX/pull/596), reviewed head `203185f`. Includes existing producers, Docker HTTPS inspection, task proxy authentication, trusted collection and SQLite search/UI. Read the limitations below before calling audit complete. | +| Exact task/run/tool/action/policy/approval provenance | **Partial / open** | #596 has trusted identities where available; Docker observations identify a task, not an exact worker/run/Bash invocation. A common policy-revision/approval/evidence graph is not implemented. | +| Recognizable secondary destinations and SSRF/RCE investigation | **Open** | Submitted-target and command/artifact indexing, exact triggering-action links and independently correlated receipts are missing. A remote second hop is outside Docker's network boundary. | +| One authoritative action/policy/budget contract for every executor | **Partial / open** | Scope checks, target gate, judge and scheduler budgets already exist. Typed deny/port/protocol/method/path rules, independent indirect-action authorization, cross-path consistency and bounded revocation need further implementation/qualification. | +| Remote-content prompt-injection protection | **Existing layers; end-to-end qualification incomplete** | Code-owned prompt tails, nonce framing and judge warnings exist. Docker bounds some resulting actions; neither Docker nor successful boundary unit tests proves model immunity or complete summary/handoff provenance. | +| Strict audit durability and complete coverage intervals | **Open** | #596 uses bounded best-effort queues/spools and reports detected loss. It does not stop all work on audit loss or implement a durable, complete coverage-interval ledger. | +| New Go/bubblewrap runtime as a release prerequisite | **Replaced by Docker** | [Backend decision](bubblewrap-backend-plan.md). Preserve the old document path for links; a future alternative requires its own demonstrated need and qualification. | + +## Current architecture and trust boundaries + +```text +trusted panel: scheduler, model calls, judge, target approval, task scope + | + +-- authenticated runner API --> Docker daemon (trusted host control) + | | + | task worker + descendants + | task workspace, restricted runtime + | | + | per-task internal network + | | + | task egress proxy --> egress network --> target A + | scope + pinned final dial + | private connection log + | + +-- panel HTTP/WebFetch: separately enforced task scope + +-- browser/MCP/file services: explicit coverage inventory required + +remote target A --> target B is outside this execution boundary +``` + +The Docker socket belongs to the runner, not the worker. The runner is a privileged +control-plane service, not a sandbox for attacker code. The logical agent/model +loop remains in the panel. A task's logical workers and overlapping Bash calls +share its container and writable workspace; this is **task separation**, not +mutually distrusting per-agent/per-run isolation. A timeout destroying that worker +also terminates sibling executions in the same task. Other tasks keep their own +workers. Workspace contents survive worker recreation by design. + +At the pinned main baseline the runner API is authenticated, but the worker-facing +HTTP/SOCKS proxies do not yet require #596's task credentials. Broad CIDR grants +must account for peer-proxy reachability; a private audit mount alone does not +prove which task initiated a request through that proxy. + +Bash and custom command tools use the runner when required. Native HTTP and +WebFetch run in the panel and use task-scope validation/pinned dialers; they do not +all traverse the same container proxy. Browser navigation guards are not proof +that every browser subresource/socket is confined. Shared/remote MCP and file-tool +paths need their own ownership, confinement and attribution evidence. Wrapping +Bash must not be described as wrapping every tool, service or goroutine. + +See [agent/sandbox.go](../agent/sandbox.go), +[server/customtool.go](../server/customtool.go), +[server/sharedbrowser_guard.go](../server/sharedbrowser_guard.go) and +[server/mcpdiscover_sandbox_test.go](../server/mcpdiscover_sandbox_test.go). + +## Scope enforcement already in main + +The execution boundary has default-deny target permissions when no approved +scope is available. Main's `EgressPolicy` authorizes domain suffixes and explicit +IP/CIDR entries, resolves a destination and dials a selected permitted address. +Private/metadata/IPv6 destinations are denied by default; explicit CIDR grants +can authorize otherwise denied addresses. Do not describe that as an absolute +metadata/private-address ban. Mixed DNS answers select a permitted address rather +than rejecting the entire response just because another answer is denied. + +HTTP, CONNECT and SOCKS5 TCP use this policy. Removing proxy environment variables +does not give a worker a direct external route. SOCKS is still an allowed TCP +transport, not URL-level inspection. DNS resolution is a separate deployment +boundary; proxy destination checks alone are not proof that every DNS channel is +contained. UDP, ICMP, QUIC, arbitrary browser traffic and remote executors do not +inherit a blanket support claim. + +The task gate/judge and the proxy are distinct enforcement layers. Scope lowering +currently carries domains/CIDRs and supported task allow rules; it is not a +versioned translation of every intercept deny rule or exact-host/port/path rule. +Approval of a tool operation does not by itself approve a new network target. +Conversely, an allowed target does not authorize every operation on that target. + +Scope changes cause proxy reconciliation through task execution/scope snapshots. +This is not a demonstrated immediate revocation channel for every in-flight +request, pooled connection and existing tunnel. Pause/Kill targets worker +processes and may preserve the proxy; Delete removes the proxy/network. Publish +and test revocation semantics separately rather than inferring them from Delete. + +## Audit implementation in pending #596 + +The reviewed implementation is +[`203185f`](https://github.com/renaesop/ARTEX/tree/203185f6dbb23dadafa8e84e25b196aa2dcbdb93), +not main. Its [implementation/coverage documentation](https://github.com/renaesop/ARTEX/blob/203185f6dbb23dadafa8e84e25b196aa2dcbdb93/docs/access-audit.md) +is the source for this section. It must be reconciled with newly merged main work, +including #764, before merge; branch test results do not certify a future rebase. + +- `native_http`, WebFetch trace, local execution proxy, recording proxy and + operator-reported imports are separately labeled producers. Docker adds + `docker_egress` request/response-header/error observations while full capture is + off. CONNECT alone is not a visited URL, and a response is not proof of business + processing at the origin. +- Each task proxy generates a persistent CA. Only the public trust bundle is + mounted read-only into its worker; the signer and audit spool remain private. + Upstream TLS verification and scope/pinned dialing stay enabled. HTTP and + SOCKS require independent task credentials, preventing another task from + borrowing proxy attribution merely because a broad CIDR includes both proxies. +- The runner exposes authenticated, bounded, task-confined spool reads. The panel + imports observations, deduplication keys and cursors transactionally. Docker + task identity is supplied by the trusted collector, never by target headers. + Unknown worker/run/tool-call identity stays unknown. +- The chosen store is SQLite `traffic/_index/access.sqlite`, not the earlier + proposed PostgreSQL metadata schema. There is no new PostgreSQL migration; + `0024_task_scope_egress` remains unrelated and untouched by #596. Retention is + 30 days / 500,000 events; task/full-capture deletion does not delete this index. +- Search supports URL/path substring, exact host, task, source and a bounded time + window with keyset pagination. Userinfo, **all query keys/values**, fragments, + headers and bodies are omitted. URL paths can still contain secrets. This is + searchable redacted URL/path evidence, not preservation of every original URL + byte or the full set of proposed event/filter fields. +- Proxy spools keep two 4 MiB segments per task. Bounded asynchronous queues, + rotation and crashes can lose records. Detected gaps and collection state are + visible; normal task networking does not stop merely because audit persistence + is unavailable. Startup readiness checks do not turn this into strict durable + auditing. Runner-imported observations preserve producer time; HAR/extension + reports currently use ingestion time and are labeled external reports. + +### TLS compatibility and deployment + +The selected Docker audit mode decrypts HTTPS to observe paths. Certificate-pinned, +mutual-TLS and HTTP/2-only clients are not supported by this inspection path; +there is no silent opaque HTTPS fallback. Custom private origin CAs belong in the +proxy image's trust store. Client `curl -k` does not disable upstream verification. +SOCKS/raw TCP still have connection-only visibility, so full URL coverage is not +universal even after this PR. Do not equate inspection with method/path enforcement. + +Deploy matching panel, runner and egress-proxy images. #596 rejects an unready/old +proxy image and recreates pre-audit workers to install the trust mount while +preserving their workspace. A rollback must restore compatible components and +workers; it must not silently set `ARTEX_SANDBOX=off` or erase retained audit data. + +## Remaining policy and authorization contract + +Extend the existing scope/target-gate/judge and task budget mechanisms rather than +creating a competing gateway or scheduler. The following are **acceptance targets**, +not claims about current Docker behavior: + +| Area | Remaining contract | +| --- | --- | +| Policy identity | Server-owned policy ID/revision/digest, execution binding, effective/expiry/revocation state and approver reference; requests cannot self-select a stronger grant. | +| Rule semantics | Typed host/IP/CIDR, address constraints, explicit deny precedence, port/protocol and optional method/path rules; document exact/suffix/IDNA and normalization behavior without silently changing existing rules. | +| Final hop | Recheck the effective rule at the actual dial/request and each redirect; an upstream proxy must offer equivalent address enforcement or report unsupported. | +| Revocation | Stop affected actions and established channels within a measured bound, including keepalive, CONNECT, SOCKS, WebSocket and SSE. Restart/scope-edit handling must not revive an old grant. | +| Indirect action | Recognizable submitted secondary destinations and action classes receive deterministic scope checks plus applicable judge/operator approval. Unknown remote effects remain unresolved/reviewable, never implicitly authorized. | +| Control plane | Narrow operational grants and protected credentials; model or returned text cannot change policy, approve itself, raise limits, disable audit or borrow a trusted actor identity. | +| Coverage | Explicit contracts for panel-native HTTP, browser, MCP and file tools. Unsupported required capabilities reject that profile; the default Docker setting is not proof of universal enrollment. | +| Budgets | Reuse existing task/intent token, turn and time accounting. Add request/byte/connection/redirect limits and aggregate enforcement across worker, proxy, panel and enrolled services; record limits, stop authority, overshoot and authorized resume. | + +Docker CPU/memory/PID settings and capped stdout are useful implemented limits; +they do not finish this whole-task budget contract. Effective host capabilities, +concurrent descendants, failure cleanup and limit exhaustion need measured tests. +This status update does not requalify kernel isolation or workspace/download/ +storage quotas. Those omitted areas must not acquire an unsupported guarantee. + +## Remote-content injection and indirect-access investigation + +Retain the existing [code-owned prompt rules](../agent/untrusted_prompt.go), +[nonce framing](../agent/untrusted_boundary.go), MCP-description boundaries and +[judge input rules](../intercept/prompt.go). Returned pages, headers, MCP output, +scanner output, downloaded artifacts and their summaries are untrusted data even +when the destination was approved. Source IDs and roles must be assigned outside +that text. Compaction, memory and handoff must preserve the distinction; neither +summarization nor a forged “human approved” field may create authority. + +The missing acceptance chain is: trusted source/artifact reference → proposed +exact action → independent decision/policy revision → actual observation. Test it +with inert fake roles, delimiters, operator claims, secret-read/callback requests, +summary-to-next-turn propagation and benign quoted instructions. Assert the +resulting authorization/network/file boundary independently of what the model +says. Boundary unit tests are valuable, not a proof of model-level immunity. + +**Allowed-channel callbacks remain possible.** An injected command can use an +allowed HTTP(S)/SOCKS destination for data transfer or command exchange. Task +isolation, TLS inspection and audit do not make reverse shells universally +impossible. Stronger restrictions require explicit action/protocol/target policies +and a corresponding compatibility decision. + +A request from ARTEX to allowed target A can induce A to contact B. Neither Docker +nor a local proxy controls A's network. The original #553 investigation requirement +therefore remains open even if every direct request to A is collected: + +1. Index candidate command/script/artifact references and destinations actually + submitted in supported query/form/JSON payloads, before general redaction. + Keep bounded, versioned extraction, safe target structure, artifact digests and + exact trusted action IDs; do not retain arbitrary raw bodies/queries by default. +2. Distinguish `command_reference`, `submitted_target`, `network_observation` and + independently sourced `correlated_receipt`. A URL merely quoted in a returned + document is not an action or a visit. Extraction grants no authority and must + not fetch the extracted URL or execute an artifact. +3. Accept independently obtained callback/OAST or target receipts with real + correlation. Host/time proximity alone does not establish a causal edge. + Dynamic/opaque code can remain unresolved; Docker cannot prove a remote negative. +4. Starting with only a reported destination/time window, expose the triggering + task and exact action/artifact in the UI/API without live agent disk scanning. + Concurrent tasks cannot borrow each other's evidence; archive references and + unknown attribution remain explicit. + +These are basic investigation requirements, not a new automatic honeypot detector. +Keep target claims, observations, operator/judge assessments and corroboration +separate. Do not turn a fabricated success response into a verified finding or use +suspected honeytokens automatically. The existing +[advisory review guide](operator-advisory-review.md) helps check vulnerability +claims; it does not implement an automated deception/evidence engine. + +## Audit contract still to complete + +Preserve immutable/idempotent observations separately from assessments. Add exact +policy/approval links, observation versus ingestion times, actual endpoint details, +retry/redirect relationships, capture/artifact/archive references and budget/stop +history only where instrumentation establishes them. Do not synthesize all those +fields from today's smaller Event struct. + +A direct socket blocked outside a proxy may have no per-destination event. A proxy +403 is not an upstream 403; a response-header event is not stream completion. A +transcript match is an investigation candidate, not backfilled network history. +Never display “no access” when only “no matching retained observation” is known. + +The proposed strict audited profile additionally needs measured backpressure, +explicit coverage intervals and refusal of new work when neither durable storage +nor its bounded spool can accept required evidence. #596 does not implement that +profile. Retention/administrative deletion, archived-task pointers and authorized +raw evidence/export access need their own tested semantics; existing capture and +archive features must remain usable. Do not weaken redaction to fill provenance +fields or imply current audit rows are cryptographically tamper-proof. + +## Upstream distribution and migration contract + +Docker execution is already required by default, including the standard Compose +configuration. Do not document a new opt-in bwrap rollout or silently migrate +users to `off`. Missing runner/token/daemon/images must fail required task +execution with diagnostics; management/audit features do not thereby gain a new +bwrap dependency. Preserve the explicitly degraded local mode and its warnings. + +Keep all five controller release targets: Linux amd64/arm64, macOS amd64/arm64 and +Windows amd64. See [release workflow](../.github/workflows/release.yml). Container +build targets are Linux amd64/arm64; image publication is not equivalent to runtime +qualification on every architecture/host. A controller ZIP does not bundle a +Docker daemon or establish native macOS/Windows tool isolation. Docker Desktop, +Linux guests and separately hosted runners require their own mount/network/trust +and failure tests; only claim platforms actually qualified. + +The [runtime evaluation](sandbox-runtime-evaluation.md) keeps earlier alternatives +as dated research. Native non-Linux sandboxes, VM/gVisor profiles, general browser +or nested-container support and fleet orchestration are separate proposals, not +prerequisites for claiming the Docker baseline that already exists. + +## Revised delivery and exit gates + +The fixed four-PR sequence no longer describes upstream history. Keep the original +requirements as acceptance criteria; do not create three redundant implementation +PRs or mark all requirements finished to preserve the old PR count. + +| Workstream | Current disposition | Next exit gate | +| --- | --- | --- | +| #555 design | Update to this Docker baseline and completion matrix | Source-backed distinctions between merged, pending, replaced and open work. Documentation only. | +| Execution backend | Already in main; #764 lifecycle fixes merged | Maintain Docker regression coverage and qualify declared hosts/architectures; no replacement bwrap prerequisite. | +| #596 audit/search | Direct observation and Docker audit implemented on its Draft branch | Reconcile current main, retain safe collection/TLS/identity behavior, and complete the outstanding investigation acceptance before claiming the full audit feature complete. | +| Policy/action/budget work | Existing controls plus remaining contracts above | Review changes to the existing paths, with cross-executor policy, indirect-action, prompt-boundary, revocation and quota fixtures; no unimplemented “strict” label. | +| Additional runtimes/advanced analysis | Optional follow-ups | A concrete need, support contract, maintenance owner and separate qualification. | + +Use owned synthetic HTTP/TLS services, controlled DNS and inert artifacts. Required +fixtures include scope denials, explicit CIDRs, DNS changes, redirects, missing +proxy variables, native transports, task credential forgery, cross-task versus +same-task behavior, long-lived channels, timeout/cancel/delete/restart, failed +cleanup retry, capture-off collection, spool loss/restart/deduplication, TLS +compatibility, and the A→B investigation cases above. Preserve existing capture, +rewrite, HAR, archive and governance behavior. Unsupported environments are +reported separately; a failed promised property must not be relabeled a skip. + +Readiness requires measured functional/security acceptance and review. Passing +automated checks does not complete an unmet product requirement. #596 remains +Draft for its missing indirect-access investigation workflow; Docker execution +itself is already implemented upstream. + +## Verification record and limits + +The earlier cc01 Linux run for #596 head `203185f` passed 48 focused Docker/security +tests and skipped 3 PostgreSQL-dependent tests in that focused invocation. It +covered owned HTTP/TLS targets, curl/Python, task-proxy impersonation across an +allowed CIDR, read-only public CA, private-key separation, collection and cleanup. +Broad regression/race runs had the known root/local-executor +`TestPrepareExecPrivilegeOwnsKeysAndConfigAsRoot` failure, independently reproduced +on then-main `0f22112`. These are branch/host-specific results, not qualification +of this newer main, all five platforms, every proposed budget or remote RCE effects. + +For this documentation revision, validate local/pinned source links, consistent +status/defaults, Markdown and `git diff --check` on the designated Linux checkout, +and run focused existing nonce/prompt-tail/sandbox regressions. Record actual +commands, base/head and skips in the PR description. No runtime deployment or +new containment qualification is performed merely by updating this document. diff --git a/docs/sandbox-runtime-evaluation.md b/docs/sandbox-runtime-evaluation.md new file mode 100644 index 000000000..101335a3c --- /dev/null +++ b/docs/sandbox-runtime-evaluation.md @@ -0,0 +1,99 @@ +# Sandbox runtime evaluation: current decision and historical research + +Reconciled 2026-12-02 against main +[`8f91643`](https://github.com/BaaRai/ARTEX/tree/8f91643). +**Current execution backend: Docker, already integrated upstream.** +Companions: [scope/audit status](managed-execution-scope-and-audit.md) and +[backend decision](bubblewrap-backend-plan.md). + +## Evidence and scope + +The earlier 2026-11-27 research compared SRT, Go/bubblewrap and other runtime or +orchestration options. It preceded upstream's current Docker task execution +architecture and selected a new bubblewrap adapter. That selection is superseded; +it must not be presented as an outstanding implementation prerequisite. + +The detailed, dated research is preserved in +[the previous evaluation](https://github.com/renaesop/ARTEX/blob/bd3547a3d65a609a2d5483a3593ce1113f7c8de7/docs/sandbox-runtime-evaluation.md). +Its package/release numbers, vendor feature claims and Windows limitations are a +historical snapshot, not current version recommendations or new qualification. +This revision checks ARTEX source/PR state; it does not repeat every vendor survey, +install an alternative runtime or run new cross-platform containment benchmarks. + +## Why the decision changed + +Main already provides an authenticated Go runner, per-task Docker workers and +networks, scope-enforcing proxies, isolation defaults, image packaging and +lifecycle cleanup. [#764](https://github.com/BaaRai/ARTEX/pull/764) is now merged. +Building a parallel bubblewrap supervisor/private gateway bridge would duplicate +substantial delivered work and introduce another lifecycle/support contract. + +The remaining work is primarily policy consistency, trusted evidence, investigation, +revocation and qualification. Changing the containment primitive does not by +itself supply those features. The useful comparison is therefore whether an +alternative closes a concrete measured gap, not whether it matches the old plan +or happens to use Go. + +Docker is not declared universally superior, and existing integration is not +proof of complete security qualification. Keep hardening the current implementation +against its stated guarantees. The exact distinction between main and pending +[#596](https://github.com/BaaRai/ARTEX/pull/596) is maintained in the +[completion matrix](managed-execution-scope-and-audit.md#completion-assessment). + +## Four different portability claims + +1. The ARTEX controller compiles/runs on a host OS. +2. Its client can contact a runner or sandbox service from that OS. +3. A backend actually creates and enforces an execution boundary there. +4. That boundary executes the required guest/tool OS and tool set. + +A Go API or Windows ZIP does not establish native Windows isolation. Docker Linux +containers execute Linux tools even when the controller is elsewhere. Build +artifacts, source availability and a successful startup are not runtime acceptance. +Preserve Linux amd64/arm64, macOS amd64/arm64 and Windows amd64 controller builds; +qualify the actual executor platform separately. An x86_64 cc01 test does not +certify ARM64, Desktop/WSL, nested containers or arbitrary remote runners. + +## Alternatives retained for a demonstrated need + +- A lightweight local adapter, including the former bubblewrap direction, could + be reconsidered if a supported deployment genuinely cannot use the Docker + contract. It needs its own lifecycle, policy transport, capabilities and tests. +- A native macOS/Windows backend must meet actual host credential, process, file, + network and tool requirements. Do not inherit a qualification claim from an SDK, + helper's presence in an archive or the Linux implementation. +- Stronger VM/runtime profiles can be evaluated for an explicit threat model. + They are not substitutes for policy, prompt boundaries or evidence provenance. +- Fleet platforms and orchestration systems become relevant when scheduling, + snapshots or remote pools are concrete requirements. They are not required just + to update this design or finish the existing Docker audit path. + +No new dependency on bwrap, Node/SRT, Fence, a VMM or an orchestration service is +introduced by this design revision. Existing frontend and tool dependencies keep +their own requirements. Any future selection must recheck the candidate's current +official sources and supported artifacts rather than reuse the historical survey +as a present-day security endorsement. + +## Acceptance for any supported execution profile + +- Name the runtime/image/platform/capability versions, maintenance owner, supported + installation path and compatible upgrade/rollback procedure. +- Test admission failures and unsupported capabilities without silent host or + privileged fallback. Configuration values alone do not prove effective limits. +- Verify task separation, environment/credential boundaries and actual execution + ownership. State whether concurrent workers within one task share the boundary. +- Check final-dial scope, redirects, DNS/address rules, upstream proxies, live + revocation and long-lived channels across all declared managed paths. +- State TLS visibility and compatibility explicitly. Inspecting HTTPS does not + itself implement URL/method policy, and opaque traffic cannot supply a URL path. +- Exercise capture-off metadata, attribution, retries/restart, bounded loss, + durability semantics and investigation from reported destination to action. +- Verify timeout/cancel/delete cleanup, retained retry state and aggregate resource + accounting. Preserve existing scheduler budgets and approval semantics. +- Use inert prompt-injection/deception and A→B fixtures. Distinguish observations + from target claims and remote effects; do not promise model immunity, automatic + honeypot recognition or complete prevention of allowed-channel callbacks. + +These criteria remain applicable to Docker. Delivered runtime mechanics and +unmet product/security contracts must be assessed separately. The old fixed +four-PR plan is not an implementation checklist for today's upstream.