Docs

Sandbox security

Alien treats code inside a Sandbox as untrusted. The app that creates sandboxes is trusted within its permissions, and so are cloud and cluster administrators.

Give sandbox code only the secrets and files it may read: an allowed destination can receive anything that code can access.

Isolation

PlatformBoundaryGuest restrictions
AWSLambda MicroVMThe agent runs commands under a different identity from itself. "internet" egress is bounded by subnet routes and security groups outside the guest.
Google CloudAgent Platform sandboxThe provider enforces its container boundary. Direct { mode: "allow" } egress doesn't exclude private destinations.
AzureContainer Apps sandboxRegistry and source builds use Alien's agent. Catalog images keep native exec. Azure enforces native egress policies outside the guest, but they don't prevent every DNS lookup.
KubernetesPod under a sandboxed RuntimeClassNo service account token. NetworkPolicy restricts the pod from outside its processes. Needs an enforcing CNI.
LocalDocker container sharing the host kernelFor development. Not a boundary for hostile code.

On Kubernetes, every sandbox pod uses the RuntimeClass in the chart value sandbox.runtimeClassName. Left empty, the chart picks it from the cluster's Kubernetes version:

  • EKS: isolated-sandbox, AWS Nitro Sandboxes on EKS Auto Mode. Needs Kubernetes 1.36 or later.
  • GKE: gvisor.
  • AKS: set kata-vm-isolation.
  • On-premises: set the gVisor or Kata class your administrator installed.

Argo CD renders the chart without the cluster version, so set the value there on EKS and GKE too. The Alien Operator in the cluster checks that the class exists and uses a sandboxed handler (Nitro Sandboxes, gVisor, or Kata), and refuses an ordinary container runtime.

Users and privileges

Agent commands and jobs have no Linux capabilities and run with no_new_privs, which blocks gaining privileges through executable files.

PlatformAgentCommands and jobsImage startup
AWSRoot supervisorUID 60000 for a root or absent image USER, otherwise the image's non-root UIDImage USER, once per boot. Absent USER means root when the sandbox has an egress connector. Explicit root requires "internet" or "none".
Google CloudRoot supervisorUID 1000 for a root or absent image USER, otherwise the image's non-root UIDImage USER, once per boot. Absent means root.
Azure agentRoot supervisorUID 1000 for a root or absent image USER, otherwise the image's non-root UIDImage USER, once per boot. Absent means root. Starts after the binding verifies the provider's network policy.
Azure catalogNo Alien agentImage USER, which may be root. No jobs.Native startup. The image's metadata can't be inspected.
KubernetesThe image's non-root UID. Root supervisor for a root image USER.The image's non-root UID, all capabilities dropped. A root image's commands run as a separate non-root UID.Image USER, once per boot. Root requires "internet" or "none" and amd64 nodes, and runs in the namespace set by the chart's sandbox.namespace value, which must admit the Pod Security baseline. The image must start the agent.
LocalNo Alien agentUID 65534 without USER, otherwise the image's non-root UID. All capabilities dropped. No jobs.Explicit root is refused. The image command is replaced with a keepalive shell.

On AWS, Google Cloud, Azure agent, and Kubernetes images, a root startup process gets Docker's default capabilities except NET_RAW. Its effective, permitted, and bounding sets are 0xa80405fb, and its ambient and inheritable sets are empty. It also runs with no_new_privs.

Non-root startup processes have no capabilities.

What root can and can't do:

  • It can switch UIDs, change file ownership, and bind low ports.
  • It has no SYS_ADMIN, NET_ADMIN, or NET_RAW. It can't mount filesystems or change the sandbox network.
  • It can't overwrite the agent binary or /opt/alien. Private read-only mounts protect them before image startup, and protected parent mounts block replacing them by renaming a directory.
  • It shares the agent's PID namespace, so it can signal commands and the agent and disrupt its own sandbox.
  • It can read every guest file and change other writable files. File ownership inside the guest doesn't protect data from it. Keep secrets and credentials for your own systems out of the sandbox.

On AWS, an "internet" build plans the gateway before it's installed. Deployment requires the prepared gateway, and a missing gateway doesn't enable a fallback startup.

Google's custom image requirements say images must not require root. Alien's Google Cloud probes passed with root, but that is observed behavior, not a provider guarantee.

Sources: image identity resolver, privilege drop, platform checks.

Device access

On AWS images with image-user startup and on Azure agent images, guest processes can't read, write, or create block devices, including existing device nodes. Loop devices, raw disk access through blkid or fdisk, and device mapper are unavailable. These platforms need cgroup2 with CGROUP_BPF, and startup fails without it.

Only these character devices are allowed:

DeviceMajor:minor
null1:3
zero1:5
full1:7
random1:8
urandom1:9
tty5:0
console5:1
ptmx5:2
pts136:*

Every other character device is denied, including /dev/fuse, /dev/net/tun, /dev/kmsg, /dev/ttyS*, and raw SCSI and NVMe devices. Terminal I/O and PTY allocation work. Provider processes keep their own device access.

A seccomp filter blocks bpf calls, so guest processes can't remove the device filter. This applies in AWS modes without a gateway too. Gateway mode also blocks IPv6 sockets and io_uring.

On Google Cloud, Alien installs no device or seccomp filter. Root keeps MKNOD, and device access depends on the provider runtime.

Sources: device filter, seccomp rules.

Agent access

PlatformWho can call the agent
AWSGuest callers are refused at every UID, including root. Socket marks tell them apart from provider processes, with or without a gateway.
Google CloudLocal guest callers are refused at every UID. External provider calls work.
Azure agentGuest root can read the per-boot bearer token and call its own sandbox's agent API. This grants no cloud credentials and no change to egress or isolation.

Sources: caller checks, file protection, Azure token scope.

Azure transport

Azure registry and source builds use authenticated HTTPS to the Alien agent. The binding reads a per-boot credential through Azure's native file API, verifies the provider's network policy, and activates that boot. A fresh boot replaces the credential, and readiness detects a boot that hasn't been activated.

Retries never replay a command:

  • After a 401, an untyped 404, or a connection failure before delivery, the binding checks for a changed credential or endpoint, refreshes, and retries once.
  • An unchanged 401 fails without retrying.
  • An agent 404 with PATH_NOT_FOUND or JOB_NOT_FOUND returns immediately and keeps the working route.
  • Timeouts, broken responses, and server errors discard the cached route without replaying.
  • Error bodies are read up to 4,096 bytes with a separate 60-second deadline. An oversized or incomplete body leaves the command's outcome unknown.

Session labels pick the transport when reconnecting across upgrades or rollbacks. Unknown labels fail closed, and an agent error never falls back to native exec. See the Azure transport.

Native Azure sessions, including new catalog sessions, don't have the agent restrictions above. A native root image can run with full capabilities, so mounts and network changes succeed there. Use a registry base image or a Dockerfile to get the agent.

Egress path

For "internet" sandboxes on AWS and Kubernetes:

Architecture diagram. Left: Your app, Worker or Container. Right: Customer environment containing routes: only the gateway containing Sandbox; Egress gateway, per-sandbox policy, no private, metadata,, or deployment addresses; NAT; Internet.

Subnet routes or a NetworkPolicy leave the gateway as the sandbox's only reachable address. The checks run outside the sandbox.
PlatformExternal enforcement
AWSSandbox subnets have no direct internet route. Security groups allow only the gateway path. The VPC resolver stays reachable.
KubernetesNetworkPolicy allows only gateway pods on TCP port 3128. A setup probe checks CNI enforcement before sandbox claims are accepted.
Azure, Google Cloud, Local"internet" is refused at plan time.

The gateway resolves destinations itself and checks every returned address. It rejects private, link-local, metadata, deployment, and container-network addresses. The gateway's own network rules also restrict its destinations.

The AWS agent checks its outbound path before accepting commands. A failed check reports EGRESS_PATH_UNEXPECTED.

Gateway

Each sandbox gets an identity token valid for at most 24 hours. The token can't change policy. It's installed at runtime and never baked into the image.

Policy writes are signed. The signing key lives in the deployment's secrets vault, and workloads with sandbox/management can read it. Never pass it to sandbox code.

On AWS "internet" deployments, an explicit deny stops the deployment's management identity from reading the key, though it can write it. Kubernetes controllers and cluster administrators stay trusted.

The gateway holds only verification keys. Even a caller with the signing key can't authorize private destinations.

Failures

A surviving replica keeps serving existing policies when another stops. New connections sent to a stopped replica can stall until the load balancer removes it.

If every replica loses its state, deletion history is lost too. A sandbox can then restore an older signed policy until a newer management write or its token expires, which can take up to 24 hours.

Permissions and remote callers

sandbox/management creates and terminates sandboxes and changes gateway policies. sandbox/execute runs code and moves files. Azure's execute role also includes lifecycle operations.

See Permissions.

Google Cloud management and execute grants bind at project scope. Use separate projects where deployments need separate sandbox access.

Remote callers hold cloud credentials directly. Their cloud grant bounds what they can do, including which images they can start.

The alien.ts declaration alone can't constrain them. See Remote bindings.

Instance metadata

Cloud probes obtained no metadata credentials. These are observations from tested configurations, not guarantees about every metadata path.

PlatformGuest access
AWSAlien attaches no execution role. Gateway and "none" probes couldn't reach metadata. With unrestricted egress, IMDSv1 returned 401 and IMDSv2 listed only placement and tags. Role and instance-identity credential paths returned 404.
Google CloudStartup, child, and exec probes timed out on IPv4. IPv6 had no route, and metadata.google.internal didn't resolve.
AzureProbes got ECONNREFUSED on IPv4 and EAFNOSUPPORT on IPv6. Native { mode: "allow" } controls also got no metadata credentials.
KubernetesNetworkPolicy excludes 169.254.169.254. The pod has no service account token. Needs an enforcing CNI.
Local"none" disables networking. With { mode: "allow" }, reachability depends on the Docker host's network.

See the metadata fixture and the AWS live guard.

DNS

.egress("none") and an egress allowlist block connections, not DNS lookups. On AWS and Azure a sandbox can still resolve names through the cloud's resolver, and the resolver forwards each lookup to the name's own DNS server, so data can leave in a hostname. On Google Cloud, a sandbox with "none" resolves no names.

DNS on AWS

AWS security groups don't block the VPC resolver. Guest root can reach it if it bypasses guest-side DNS redirection, and a hostname can carry data. Treat VPC DNS as a possible outbound channel, including with .egress("none").

The agent redirects DNS for the startup process, its child UIDs, and commands. Synthetic DNS answers don't mean the sandbox contacted an external resolver.

The AWS qualification procedure checks direct VPC queries separately, using an external DNS firewall to close the path security groups leave open. Don't infer DNS exclusion from a gateway allowlist alone.

Verification

CheckCoverage
Startup and image-user probesRoot, absent, and non-root USER images: first-exec ordering, worker UID changes, exact capabilities, mount and network refusal, and metadata requests.
Agent security checksCaller attribution, protected files, capabilities, saved image users, legacy root refusal, guest routing, BPF refusal, device restrictions, and terminal I/O, in an isolated privileged container in CI.
Egress conformance probesPaired probes for TCP, DNS, HTTP, HTTPS, proxy requests, TLS SNI, and HTTP Host. A failed positive control leaves the result unproven.
Runtime policy probesPolicy narrowing, private-address rejection, NAT address, gateway logs, and missing network attachments, on deployed fixtures.
AWS live guardDenied egress against an open control, and open internet access without metadata credentials.
Kubernetes gateway testGenerated Helm chart, gateway reconciliation, and warm-pool pods on Kind with an enforcing CNI.
CNI probePaired allowed and denied requests on the selected nodes. Checks network enforcement, not runtime isolation.

Local harness tests validate the probes themselves. They don't establish cloud enforcement. Live results apply to the tested deployment, runtime, and network configuration.

On this page