Encased — AI agent security
Security audit

Engineering reference · Python 0.3.2 isolation candidate

Encased containment: guarantees, risks and limitations

A decision is not isolation. Encased's guarantees are conditional on the controls actually installed, the paths they cover and the environment in which they run.

Not a production containment assurance. Python 0.3.2 includes an external isolation candidate. Its broker tests pass, but actual customer container bypass tests and independent security review remain required; there is no universal prevention guarantee or certification claim.

Customer-side isolation: the 0.3.2 candidate

Untrusted Python runs without internet access or credentials. A separate customer-hosted broker holds the keys, validates registered operations, requests the workspace decision and executes the frozen action itself. Removing Python hooks does not grant network access within a correctly configured container boundary.

Network and action gate
Network-none worker; only a per-run Unix socket reaches the broker. Supplied fixed HTTPS reads and fixed-model OpenAI calls require exact domain and explicit global IP/CIDR approval. Connections pin validated IPs with verified TLS; redirects and ambient proxies are not used. No generic proxy, shell or arbitrary URL handler.
Process gate
A host supervisor applies CPU, memory and PID limits, a read-only filesystem, dropped capabilities and an independent deadline. Forced container removal targets the whole worker cgroup, not just its original process group.
Token gate
Only the broker holds provider credentials. A host-private SQLite ledger reserves tokens and spend before supported calls; limits survive restarts and concurrent local brokers. Conservative reservations are never refunded.

Still conditional: Docker, the host kernel, reviewed images and trusted broker handlers are part of the security boundary. Container escapes, approved-channel data leakage and already-dispatched remote effects remain risks. No Docker engine or connected Linux VM is available in the builder environment; nine Docker-gated probes remain unverified. Lucas or another qualified engineer must qualify the customer host before production use. The supplied effect allowlists are not a host-wide firewall; Encased control traffic remains a separate trusted channel.

The host journal prevents re-dispatch of a consumed request ID after restart, not duplicate business effects under a new ID. Run counters reset with a new broker; budgets persist in the selected ledger. Operator stop prevents new admissions, but cannot undo an already admitted remote action. No hosted remote kill channel is included.

What the controls can guarantee

The cooperative wrapper controls below remain distinct from the new isolation candidate. Neither a hosted verdict nor an accepted telemetry record proves that an unwrapped customer operation was prevented.

01Hosted gateway decisions

Conditional guarantee

A workspace agent key identifies its workspace. Submitted tool actions are evaluated against workspace gate rules and recorded with a decision. Authorised reviewers approve or deny pending actions; the agent polls the same recorded decision.

Boundary / not guaranteed

The gateway decides on submitted actions; it does not independently observe all customer traffic or execute, stop or isolate the customer's agent. A caller that bypasses the gateway is outside this control.

02Protected Python tool calls

Conditional guarantee

In the tested 0.2.0 wrapper path, a protected function runs only after a validated initial allow or a matching human approval. Pending actions wait. Denial, invalid replies, gateway failure and review deadlines prevent dispatch. Submitted arguments are copied before waiting.

Boundary / not guaranteed

This applies to explicitly wrapped functions, not arbitrary code. One wrapper invocation dispatches at most once locally; the API does not provide single-use permits or exactly-once downstream effects. Use downstream idempotency and never replay an uncertain result.

03Python network interception

Conditional guarantee

An installed NetworkGuard checks exact HTTPS destinations on port 443, validates public DNS addresses and hooks supported TCP and HTTP paths. Unsupported destinations are refused in the tested paths; supported HTTP redirect paths are checked or disabled.

Boundary / not guaranteed

Process-local hooks are cooperative, not a hostile-code sandbox. Native extensions, pre-existing connections, escaped subprocesses, alternate network paths and tampering can fall outside coverage. Approved IP caching and connection pooling also limit what a fresh URL check proves.

04Execution and emergency stop

Conditional guarantee

Instrumented actions can be limited by count, repetition, nesting, concurrency and elapsed time. The POSIX supervisor can terminate a dedicated worker's ordinary process group on a deadline or a local stop signal.

Boundary / not guaranteed

Only instrumented actions are counted. Escaped process groups require external supervision. Termination cannot undo a remote action. Call-stack checks do not reliably detect every prompt injection or semantic drift, and the dashboard is not yet a remote worker-kill channel.

05Provider budgets and cancellation

Conditional guarantee

Wrappers sharing one Budget instance reserve conservative token and USD limits before supported provider calls. Reservations are thread-safe; known usage reconciles once, while uncertain failures retain the reservation. Supported output limits are passed to the provider.

Boundary / not guaranteed

Budgets are worker-local, not a shared workspace ledger. Input bounds and current prices must be supplied correctly; automatic provider retries must be disabled. Closing a supported stream does not guarantee instant cancellation or zero further charges for work already in flight.

06Telemetry and evidence

Conditional guarantee

Telemetry uses the existing workspace REST service. The Python client checks acknowledgement and reports delivery failure rather than silently claiming success. Telemetry metadata is bounded and common secret and personal-data patterns are masked.

Boundary / not guaranteed

Acceptance means a record was received, not that containment or cancellation succeeded. There is no durable SDK delivery spool or complete redaction guarantee. Proposal arguments are stored as submitted; use synthetic or minimised data and never submit secrets or full memory dumps.

Residual risks

An allowed action can still be harmful
Deterministic rules inspect configured patterns and fields. They can miss novel attacks or misunderstand an operation's context; false positives can also pause legitimate work. An allow verdict is not proof of safety.
Approval does not remove execution risk
Approval covers the submitted action, but does not roll back a side effect, revive a terminated process or consume a one-time execution permit. Approval expiry, cancellation and execution receipts need further lifecycle work.
Key revocation has a specific boundary
Revoking an Encased key rejects subsequent gateway access. It does not revoke an OpenAI or Anthropic credential, stop an already dispatched tool, or terminate a running customer process.
Policies are not automatically interchangeable
Hosted tool/content policies and customer-side destination/execution settings are separate. There is no hosted destination-policy delivery/version acknowledgement service yet; simulator settings do not control customer egress.
Availability and evidence need operations
Gateway outages or review timeouts stop protected dispatch, which can interrupt business workflows. Define monitoring, evidence-delivery retries, retention, incident response, recovery and rollback before customer deployment.

What has been demonstrated

Functional verification

The 0.2.0 release passed 29 Python tests and 10 existing workspace tests. A signed-in preview journey exercised real REST proposals, one local allow dispatch, blocking, approval, denial, dashboard telemetry and disposable-key revocation.

What that evidence does not establish

Provider-library tests used synthetic HTTP responses, not billable model calls. Customer deployments, hostile-code bypass resistance, all framework combinations, sustained load and independent penetration testing have not been established by those checks.

Qualified test environment: Linux, Python 3.13.12; requests 2.34.2, urllib3 2.8.0, httpx 0.28.1, aiohttp 3.14.5, OpenAI 2.54.0 and Anthropic 0.125.0. Other combinations require qualification.

For 0.3.0, 48 Python tests passed, including real local Unix-socket dispatch, allow/review/deny handling, durable duplicate rejection, telemetry failure, deadline enforcement and restart-persistent concurrent budget reservations. Two Docker bypass tests were skipped because a qualified Docker host is unavailable here; skipped tests do not establish isolation.

For the 0.3.2 update, 80 Python tests were discovered: 71 passed and nine Docker-gated probes were skipped. Fourteen new deterministic network tests cover domain/IP refusal, mixed DNS, address pinning, redirects, proxy avoidance and provider transport restrictions using synthetic responses. This is local functional evidence, not a cloud-VM containment result or independent assessment. The dated 0.3.0 builder assessment remains historical.

Supported provider paths: OpenAI chat completions, synchronous streaming and synchronous/asynchronous non-streaming; Anthropic messages, synchronous/asynchronous non-streaming. Async streaming, Anthropic streaming, other provider APIs and the older framework adapters are not qualified enforcement paths in this release.

Python coverage and deployment reference

Before customer production use

Lucas or another security engineer should review the enforcement layer and customer environment. The application builder owns any agreed hosted policy and approval-lifecycle extensions; operational and privacy owners must sign off on their own areas.

  1. 1.

    Agree the supported OS, Python version, provider libraries, tool integrations and operations outside coverage.

  2. 2.

    Deploy non-root dedicated workers with external deny-by-default egress, reviewed proxy/firewall rules and container or cgroup limits; test alternative network paths and escaped child processes.

  3. 3.

    Demonstrate allow, block, approval, denial, timeout, service failure and key revocation using disposable data and controlled destinations.

  4. 4.

    Measure budget overshoot, cancellation latency, repeated actions, concurrency and performance overhead; implement a shared ledger if multiple workers share a budget.

  5. 5.

    Validate exact-action approvals, downstream idempotency, crash recovery and uncertain outcomes; agree missing approval lifecycle extensions with the application builder.

  6. 6.

    Review secret handling, consent, access boundaries, retention and evidence-delivery failures; do not upload complete process memory by default.

  7. 7.

    Assign release, monitoring, backup/recovery, incident response and maintenance owners; obtain an independent security assessment before production containment claims.

An audit assesses the agreed scope and reports evidence and limitations. It does not automatically deploy remediation or certify complete containment. Encased is not independently SOC 2 audited or ISO 27001 certified.