Isolation Levels¶
Every sample runs its commands in a sandbox, and every sandbox is isolated: it starts
with no internet and cannot reach other evals or the cluster. isolation in the
eval-set config sets how tightly it is locked down, and what it may reach.
| Level | What it means |
|---|---|
strict |
The sandbox runs without privileges, on a hardened runtime that keeps it off the shared kernel, and reaches only what the eval set allows. Use it for any eval that can run this way. |
standard |
The sandbox is usually an ordinary container, and the task decides its own network. Use it for a task that cannot run at strict. |
An eval set that sets no isolation runs at your deployment's default level. That is
standard unless its operator chose strict, and hawk eval-set tells you when it is
strict.
Words this page uses
| Word | What it means here |
|---|---|
| Sandbox | Where the agent's commands run: the containers Hawk starts for one sample. |
| Service | One container of a sandbox. Most sandboxes have one, named default. |
| Node | The machine in the cluster that a sandbox runs on. Sandboxes share nodes. |
| Kernel | The core of an operating system. Code that takes over a kernel controls everything that runs on it. |
| Runtime | What a sandbox runs on: an ordinary container, or one of the hardened runtimes (gVisor, Kata, a Nitro Sandbox), which put a boundary between the sandbox and the node's kernel. |
| Runner | The program that runs your eval set and calls the model, outside the sandboxes. hawk logs shows its log. |
| Deployment, operator | The Hawk installation you use, and the people who run it. |
Quick answers¶
| I want to | Do this |
|---|---|
| Lock a sandbox down | isolation: strict |
| Give it the internet | isolation: {level: strict, allow_domains: ["*"]}, or name the hosts (Internet access) |
| Reach a host on a port other than 80 or 443 | On a task item that names runtime_class: nitro and no host, its address in allow_cidr, as 203.0.113.7:5432; otherwise run the task at standard, with the address in its own allowCIDR (Internet access) |
Use a GPU at strict |
isolation: {level: strict, allow_gpu: true} (A GPU) |
Use provider-side web search or web fetch at strict |
isolation: {level: strict, allow_server_side_tools: true} (Provider-executed tools) |
| Run a human eval | Nothing: it runs at standard (A hardened runtime without strict) |
| Give tasks in one eval set different levels | isolation on a task item (Mixed eval sets) |
Find out why a task fails at strict |
What strict changes |
| Run in a Kata microVM | isolation: {level: strict, runtime_class: kata} (Kata and glovebox) |
IsolationConfig lists every field.
Internet access¶
A sandbox starts with no internet, and you opt in. This is about what commands in the sandbox reach: the runner calls the model and installs the eval set's own Python packages outside it.
At strict, the eval set opts in:
or names only what the eval needs:
- A named host is reachable on ports 80 and 443 only, and by its exact name: a wildcard
such as
*.example.comis refused. For another port, or an address range, grantallow_cidrin place of the names, on a task item that namesruntime_class: nitro, or run the task atstandard. - The egress proxy says which requests
a named host takes, what
allow_requestsadds, and what*gives up. - Your list replaces the task's own, and what you leave out is dropped without an error.
- A task cannot opt in for itself. One that asks for internet when the eval set allows none is refused as the eval set starts.
- With
runtime_class: katathis differs:*needsnetwork: open(Kata and glovebox).
At standard, the task opts in, in its Docker Compose file:
More on internet access
*inallow_domainsreaches every host by name or by address, on every port. It is the one spelling:allow_cidrrefuses0.0.0.0/0. A sandbox with no network card reaches public hosts alone with it, over TCP alone.- A grant opens nothing inside the cluster: other pods, nodes and the Kubernetes API stay out of reach.
- At
standard, for named hosts only, useallowDomainsandallowCIDRin the task'svalues.yaml, or a top-levelx-inspect_k8s_sandbox: {allow_domains: [pypi.org]}in its Compose file. - At
standard,network_mode: bridgecovers every service of the sandbox, except one set tonetwork_mode: none. If the file has several services, write anetwork_modeon each (bridge, ornoneto keep that one offline), or put them all on one shared network: Hawk refuses a file that setsbridgeon one service and leaves another with no network setting. - Where the deployment's default level is
strictand a task should decide its own network, setisolation: standardon the eval set. - Kata's
lockdownandpeernetworks admit named hosts only, and atstandarda task's own ranges (Kata and glovebox). - Sandbox Network Isolation has every form.
Provider-executed tools¶
Some model providers offer tools that run on their infrastructure: web search, code execution, remote MCP connectors. Your sandbox's network rules do not govern them. Treat enabling one as granting network access, and leave them off for a high-risk eval unless the eval is specifically about them.
A deployment can turn on a restriction for these tools (the operator's
strict_refuses_server_side_tools flag; ask your operator). On such a deployment, for
an eval set at strict that uses --restricted-credentials, Middleman rejects these
model requests with a 400:
- Requests that use the provider's web search, web fetch or URL context tool.
- Requests that give a provider code-execution container network access.
- Requests that reference an image or a file by URL or file ID.
- Requests with a content part of a type that Middleman does not know.
The 400 message states only the rejected item: tool 'web_search' is not supported,
web_search_options is not supported, content referenced by URL or file ID is not
supported or content type 'resource_link' is not supported. The message does not mention strict or allow_server_side_tools, because
the caller can be the model under evaluation. In the eval log, the message is the
sample's error. At launch, hawk eval-set prints a warning that the eval set's model
requests cannot use these tools, and names allow_server_side_tools.
allow_domains does not change this: the provider's servers can reach the whole
internet. Requests that send images and files inline still work.
Executions that cannot use provider-side tools
lists the rejected fields for Anthropic, OpenAI and Gemini.
To allow these requests, set allow_server_side_tools on the eval set:
The setting applies to the whole eval set, because all task items share one Middleman
token. Hawk rejects allow_server_side_tools on a task item. An eval set at standard
with strict task items has no restriction, and Hawk warns about those items at launch.
An eval set that uses user credentials has
no restriction at any level.
What strict changes¶
Most tasks run at strict unchanged. It does three things:
- Containers run unprivileged. A program cannot gain privileges it did not start
with, and
strictoverwrites any privileges a task gave its own containers. The agent can still be root, but root keeps only a few of its usual powers (Root capabilities). - The eval set owns the network. The sandbox reaches nothing but what
isolationallows, and a task's own sandbox definition cannot add to that. - It picks a hardened runtime, unless you name a
runtime_class: a Nitro Sandbox where the deployment runsstricton them, and gVisor otherwise.
strict never quietly runs without one of its controls. What it cannot run this way it
refuses as the eval set starts, with an error that names the setting:
strict refuses |
What to do |
|---|---|
| A task whose own sandbox definition asks for network access, when the eval set allows none | Allow it in allow_domains, or take the request out of the task |
| A task that sets its own DNS server, extra ports for its allowed domains, name overrides or a Hawk label, or turns its network policies off | Take the value out of the task |
A sample with no sandbox, when you wrote strict yourself |
Give the task a sandbox, or keep the eval set at standard and mark the other items strict |
A task that adds samples while it runs (Inspect's SampleSource) |
Give it a fixed dataset, or run it at standard with no runtime_class |
A human eval that asks for strict |
Use a hardened runtime without strict |
More on each refusal
- Network access. The hosts the eval set names in
isolationreplace the task's own list, and anything left out is dropped without an error.["*"]allows everything. Wherestrictis only the deployment's default and the task should decide its own network,isolation: standardon the eval set is the other way out. - A task's other network settings. Nothing in
isolationreplaces them. The error names the setting, and What every level refuses lists them. For a named host's port other than 80 and 443, run the task atstandard(Internet access). - No sandbox. A task gets its sandbox from a Docker Compose file or a k8s
values.yaml. To leave a task with none atstandardbesidestrictones, see Mixed eval sets. Under astrictthat is only the deployment's default, such a sample is not refused: it has no sandbox for these controls to apply to. - Human evals.
strictleaves the SSH session no way in. A human eval that asks forstrictis refused when you submit it. One that names no level runs atstandard, even wherestrictis the deployment's default.
Apart from a human eval's, these refusals fail the eval set as it starts, before any of its samples run. A sharded eval set checks each unit on its own worker pod, so one unit can be refused after another unit's samples have started.
A task that starts and then fails has usually hit a limit of its runtime, such as a browser's own sandbox (Chromium's), fixed CPU and memory, or 32-bit programs: What changes on Nitro, What changes on Kata.
A non-root user and a read-only root filesystem are not part of strict unless you ask:
Two controls strict leaves off.
Special cases¶
A GPU¶
No hardened runtime passes a GPU through, so at strict, or with a runtime_class
named, a service that requests a GPU is refused. allow_gpu lifts that, except on Kata
or a named nitro or nitro-32bit:
Each GPU service then runs as an ordinary container, without a kernel boundary: root's
six capabilities there act on the node's own kernel. It keeps the
rest of strict, and the sandbox's other services keep their hardened runtime. If the
task also runs untrusted code, compensate elsewhere (no internet, tighter monitoring,
human approvals) or run it on dedicated infrastructure.
Mixed eval sets¶
Set isolation on a task item, an entry under a task's items, and the rest of the set
is unaffected:
isolation: strict # every task below, unless it says otherwise
tasks:
- package: git+https://github.com/METR/inspect-metr-task-bridge@v0.5.24
name: mtb
items:
- name: bridge
args: { image_tag: audio_classification-2.1.11 }
sample_ids: [macaques_numpy]
- name: bridge
args: { image_tag: iclr_authors-2.0.1 }
sample_ids: [notable-top-25]
isolation: # this one needs the internet
level: strict
allow_domains: ["*"]
What an item's isolation does:
- It can only raise the level. An item that names a level below the eval set's is rejected.
- It replaces the eval set's other isolation settings. Repeat what the item should
keep, such as
allow_domains,non_rootorread_only_root. - Only the runtime is inherited. Where the eval set names a
runtime_class, its items run on it too (Pick a Kata network has the rules for Kata). - It does not restrict provider-executed tools. All task
items of a run share one Middleman token, and only the eval set's own
isolationrestricts that token. Where the deployment restricts these tools atstrict, Hawk warns at launch and names thestrictitems of an eval set that is notstrict. To restrict them, run those items in an eval set whose ownisolationisstrict.
An item you do not mark runs at the eval set's level.
A hardened runtime without strict¶
For a human eval, or a task that cannot run at strict and adds no samples while it
runs, name a runtime at standard, as in
isolation: {level: standard, runtime_class: kata}. That gives the kernel
boundary alone: the containers keep their privileges, and the task keeps its own
network settings as far as the runtime honours them
(Kata and glovebox, Runtime classes). Only
strict accepts allow_domains.
A runtime_class with no level takes the deployment's default level, except on a
human eval, which stays at standard.
Before you run¶
- Launch one small run before scaling up, and check it with
hawk statusandhawk logs: most refusals arrive as the eval set starts, not when you submit it. If it starts, every control ofstrictis in place:strictrefuses rather than run without one. - Read back what the sandbox may reach. At
stricta host you left out shows up as failed connections inside the samples, not as a Hawk error. Atstandardit is what the task's sandbox definition grants: Verify before a sensitive run.
Isolation bounds where the agent can go, not what it does. For high-risk runs, pair it with
human-in-the-loop approvals
(acp_server / approval), so a person reviews tool calls live and can end a run that
exceeds scope. hawk stop ends a run gracefully; hawk delete tears it down immediately.
Technical reference¶
This section is for task authors and operators: what each level does to a sandbox, and why a pod is rejected.
What changes on Nitro¶
Where the deployment runs strict on Nitro Sandboxes and you name no runtime_class,
every service of the sandbox runs in its own Nitro Sandbox. Most tasks need no change.
What you might notice:
- Tools that build their own sandbox fail. bubblewrap fails, and so does Chromium's
sandbox, which a browser uses unless it is started with
--no-sandbox. A Nitro Sandbox has no user namespaces, which they need. Run such a task on gVisor instead, withisolation: {level: strict, runtime_class: gvisor}on the eval set or on that task's item. - CPUs and memory are fixed at what the task asks for. A service gets its CPU and
memory limits, or its requests where it sets no limit, and can't use more even
briefly. One that asks for neither gets 2Gi and half a CPU, or the deployment's
default CPU if it is a
defaultservice that sets noresourcesat all. Set what the task needs in the service'sresources, in the task's sandbox definition. - A debugger attaches only to a program it started. A process can't
ptraceone that isn't its child. - No io_uring, a Linux I/O interface that a few databases and language runtimes use:
io_uring_setupfails withEPERM. - 32-bit programs do not run. An i386 binary fails with
Exec format error, unless the deployment turns 32-bit programs back on for Nitro or the eval set namesruntime_class: nitro-32bit(x86-64 only). - Some network protocols are missing. The kernel loads no module on request, so a protocol it has only as a module, such as SCTP, is not there.
- The disk has a fixed size. It is the service's
ephemeral-storagelimit, or its request without one, or 10 GiB without either. A full disk gives "No space left on device" (ENOSPC); the sandbox is not evicted. - Port 14601 is taken. Hawk's commands and files reach the sandbox through execd, a daemon listening on that port in every pod of the sandbox that has a network card, so leave it free.
- Port 3128 is taken where a sandbox with no network card uses the network. Its route to
the egress proxy and to its sibling
services listens on
127.0.0.1:3128, so leave that port free too.
Some sandboxes cannot run on a Nitro Sandbox and run on gVisor instead, as they would
without Nitro: one with a volume, a node selector of its own, a very large service, or a
runner with another inspect-k8s-sandbox. The runner's log says why, and the note on
Nitro in Runtime classes has the exact list. A sandbox with a GPU service is
refused, unless you set allow_gpu (A GPU).
What changes on Kata¶
Hawk adapts the sandbox to the VM, so most tasks need no change. Unless you
set network, the sandbox is on Kata's lockdown network if it
has one service and on peer if it has several. What you might notice:
- On
lockdownandpeer, internet access goes through a proxy.pip,curl,gitand most libraries use it without any setup. A program that ignores the standard proxy settings still goes through the same proxy. - No GPUs, and x86-64 only. Hawk refuses a task that asks for a GPU or an ARM machine.
- CPUs and memory come from the containers' limits. A service with no CPU limit gets one vCPU unless it requests more, and one with no memory limit gets its memory request, or 2Gi.
- 32-bit programs do not run. The VM's kernel has no 32-bit entry, so an i386 binary
fails with
Exec format erroron every network. - The first sandbox of a large image on a new machine can take a few minutes, while the image is copied onto the VM's own disk. Later ones start normally.
- A few low-level operations fail, even for root. No container can make device nodes
(
mknod), and onlockdownandpeera syscall filter also blocks io_uring,bpf,perf_event_open,keyctlandsetns. Each fails withOperation not permitted, so an image that does one when it starts fails there. A device node an image ships cannot be opened either, on any network. - On
lockdownandpeer, a shell loop or a serial build runs much slower, and parallel work much less so. Each program start waits until it has been recorded. Onlockdownon half a CPU, a loop that starts one program after another ran about 35 a second, against about 410 onopen, where a start does not wait. Eight such loops at once ran about 190 a second together against 360, and 64 at once ran as fast as onopen. - A VM is terminated if it uses too much memory or moves too much data. Its memory,
counting the node's cache for its disk, must stay within its limit, and it may move
about 8 GiB in and out over its life. The sample fails with
SandboxVMTerminatedError: A sandbox VM died says how to avoid both.
Runtime classes¶
| Runtime | The agent's system calls reach | Ask for it with |
|---|---|---|
| Container (the default) | the node's kernel | nothing |
| gVisor | a user-space kernel on the node | isolation: strict where the deployment doesn't run strict on Nitro Sandboxes, or isolation: {runtime_class: gvisor} |
| Nitro Sandbox | its own kernel, in a microVM on AWS's Nitro hypervisor | isolation: strict where the deployment runs strict on Nitro Sandboxes, or isolation: {runtime_class: nitro} where it installs them |
| Nitro Sandbox for 32-bit programs | the same, in a guest that also runs 32-bit x86 programs (x86-64 only) | isolation: {runtime_class: nitro-32bit} where the deployment installs Nitro Sandboxes |
| Kata, via glovebox | its own kernel, in a microVM | isolation: {runtime_class: kata} |
A task can pin kata-lockdown in its own sandbox definition, and keeps it at every level
unless the eval set names a runtime_class, or
the egress proxy refuses such a task.
A runtime_class name must be a lowercase DNS subdomain, using letters, digits, hyphens
and dots, with at most 253 characters. Each dot-separated part must start and end with a
letter or digit. The string "null" is refused. Invalid names are rejected when the
config is validated, including per-task overrides.
What the kernel boundary changes
Under runc and gVisor:
| runc | gVisor | |
|---|---|---|
| Kernel serving your syscalls | the real host kernel | 4.19.0-gvisor, a userspace kernel |
/proc/kallsyms |
populated | empty |
/sys/kernel/debug |
present | absent |
A kernel exploit written for the host kernel lands on gVisor's reimplementation instead of the host.
gVisor can look less isolated if you measure it naively. Inside a gVisor
sandbox some interfaces that are locked down under runc appear open: creating a user
namespace succeeds, /proc/sysrq-trigger is writable, and Seccomp reads as 0.
These are gVisor's emulated interfaces, not regressions. Writing its
sysrq-trigger never reaches the host, and a user namespace created inside gVisor is
gVisor-internal. Seccomp inside is unnecessary because your syscalls never reach the
host kernel directly, and runsc is itself seccomp-confined on the host side.
When scoring a breakout eval, judge whether the host was reached, not whether a dangerous-looking interface is visible.
Your deployment has to offer the runtime
strict uses a Nitro Sandbox where the deployment runs strict on them
(hawk:enableNitroSandbox and
strict_runs_on_nitro), and otherwise the deployment's installed hardened runtime
(gvisor when hawk:enableGvisor is enabled), unless isolation.runtime_class names
one. Where the deployment configures none and you name none, the runner refuses the
run. A Kata network you name, or a named nitro or nitro-32bit, that the
deployment lacks is refused when you submit; kata with no network named is
refused by the runner, as the eval set starts. Any other class you name is not
checked: where the cluster lacks it, Kubernetes rejects the pod.
The Kata classes exist where an operator sets
hawk:enableGloveboxKata. For
hawk local, which has no deployment config, set
HAWK_RUNNER_PATCH_SANDBOX=1 and name each class the cluster has, as in
HAWK_RUNNER_KATA_LOCKDOWN_RUNTIME_CLASS_NAME=kata-lockdown. The other two are
HAWK_RUNNER_KATA_PEER_RUNTIME_CLASS_NAME and HAWK_RUNNER_KATA_OPEN_RUNTIME_CLASS_NAME.
The cluster runs a peer sandbox only in a namespace labelled
glovebox.dev/peer-network=allowed, which the API sets and hawk local does not, so
label the namespace you run in yourself.
When strict does not use a Nitro Sandbox, and other Nitro details
Where the deployment runs strict on Nitro Sandboxes, some sandboxes run on gVisor
instead, as they would without Nitro:
- one with a volume;
- one with a node selector other than its architecture;
- one with a service too large for a Nitro guest
(
runtime_classhas the limits); - one whose runner has another
inspect-k8s-sandboxthan the deployment's (throughpackages, say).
The runner's log says why, and a deployment without gVisor refuses the run. A sandbox
with a GPU service stays off Nitro Sandboxes too, and is treated as it would be
without Nitro: refused, unless you set allow_gpu (A GPU).
That fallback is only for a Nitro Sandbox strict picked itself. Where you name
runtime_class: nitro or nitro-32bit, a sandbox with a volume, a GPU service or a
runner with another inspect-k8s-sandbox is refused as the eval set starts, and so
is a task that sets global, a label under inspect-ai.metr.org/, or
networkPolicy.enabled to anything but true. One with a service too large for a
Nitro guest, or with a node selector other than its architecture, is sent to a Nitro
Sandbox as written, and waits for a node that may never come. nitro-32bit refuses
a service that selects arm64.
A guest that runs 32-bit programs is weaker in one way: a 32-bit program there can
open an AF_VSOCK socket, which the sandbox's seccomp profile otherwise refuses.
Operators: you can make gVisor the default instead
hawk:enableGvisor makes the runtime available. The chart's implicit default
service names it, but task-authored services do not inherit it automatically.
Setting hawk:sandboxRuntimeClassName: gvisor makes gVisor the default for every
sandbox service that doesn't pin a real RuntimeClass of its own (nvidia, gvisor,
...). A service that writes runtimeClassName: CLUSTER_DEFAULT — the chart's "leave
the field unset" sentinel, which the METR task bridge writes on every non-GPU sandbox
— gets the default too. To run a task under the node's runtime on such a deployment,
pin a RuntimeClass that maps to it (for example runc); Hawk does not create one.
Worth considering for a cluster dedicated to cyber or otherwise untrusted evals. GPU services are exempt automatically, so they stay on the node default rather than becoming unschedulable.
Kata and glovebox¶
Hawk runs Kata through glovebox, which hardens Kata Containers for untrusted agents: a signed guest kernel and image, a hardened hypervisor config, and an egress proxy outside the VM.
level: strict and runtime_class: kata guard different things:
level: strictlocks down what is in the sandbox: its containers run without privileges, and it reaches only what the eval set allows. Unless you name aruntime_class, it also picks what the sandbox runs on. That is a Nitro Sandbox (a small VM with its own kernel) where your deployment runsstricton them, and otherwise gVisor (a kernel that runs as an ordinary program, between the sandbox and the node's kernel). Your operator can tell you which.runtime_class: katachanges what the sandbox runs on: its own glovebox VM, with a kernel no other sandbox uses, and a proxy that admits only the named hosts. Even a full compromise of that kernel leaves the attacker inside the VM, not on the node.
runtime_class: kata is optional, and it has costs: x86-64 only, no GPUs, slower
program starts and a limit on how much data a sandbox moves
(What changes on Kata).
Where your deployment does not offer Kata (its operator can tell you), leave it out:
strict alone takes the same allow_domains.
If the deployment cannot give the sandbox its Kata class, or has no hardened runtime for
strict alone, Hawk refuses the run rather than start a weaker sandbox, so trying is
safe.
A Kata sandbox is on one of three networks. lockdown and peer, which Hawk picks
between unless you set one, go through Kata's own proxy, and open does not
(Pick a Kata network). On lockdown and peer the rules for
internet access are tighter:
-
The proxy admits named hosts, and at
standarda task's own ranges, so*is refused. For the whole internet, setnetwork: open. -
A range comes from the task's own
allowCIDR, atstandard, and opens one port: 443, or the one you write after it, as in10.20.0.0/24:5432. Without Kata, and onnetwork: open, a range opens every port and takes no:PORT. - A range may be no wider than
/24(256 addresses) for IPv4 and/64for IPv6, unless the deployment's operator changed that. A wider one fails the eval set as it starts, and so does one that overlaps the cluster's own networks or reserved address space (the exact rule is in the note below). - A name resolves to a placeholder address, so at
standardreach a host on another port by its address, with the port written after its range, as in203.0.113.7/32:8443. Naming the host as well does not help. - An address in
allow_domainsis refused as the eval set starts, and so is a wildcard in a task's ownallowDomainsover a domain anyone can register under, such as*.co.uk. - For UDP, or every port of a range, run the task at
standardwithnetwork: open.
The three networks are classes of their own: kata-lockdown,
kata-peer and kata-open. They run the same VM: lockdown gives it no network card,
peer gives it one that reaches only the task's own services, and open gives it an
ordinary one. A human eval's SSH session arrives over the VM's network card, which
lockdown lacks, so a human eval refuses network: lockdown. On lockdown and peer,
the proxy admits each named host by its exact name, or every name below a *. wildcard
in a task's own allowDomains, so root inside the VM cannot widen what it reaches.
Kata networks says what enforces each
network and what none of them stops.
Details for task authors
- On
lockdownandpeeratstandard, the named hosts are the task's ownallowDomains. - On
lockdownandpeer, the cluster setsHTTPS_PROXY,SSL_CERT_FILEand similar variables in every container, and pulls each image again at every start. - On
peer, Hawk adds the sandbox's service names toNO_PROXY, so services reach each other by name. ANO_PROXYof*is refused. - The VM's size comes from the containers' memory limits. Hawk fills in a missing limit from the memory request, else the chart's default.
- Hawk removes
tcpSockethealth probes onlockdownandpeer, because there they would always pass. Use HTTP or exec probes. - On
lockdownandpeer, the cluster gives every pod its own resolver without the node's search domains, and refuses a pod that names another one. LeavecorednsUpstreamunset. - On
lockdownandpeeratstandard, a range in the task'sallowCIDRis checked as the eval set starts. It may be no wider than/24for IPv4 and/64for IPv6, unless the deployment'shawk:gloveboxAddressGrantssays otherwise, and it may not overlap the cluster's own networks, its VPC included, or loopback, link-local, multicast or other reserved address space. A deployment set tononetakes no range. - On
lockdownandpeer, Hawk also refusesallowEntities,allowDomainsPortsand a sandbox that turns off the chart's network policies. - On
lockdownandpeer, every container runs under a syscall filter, and each program a container starts waits until it has been recorded. A start that is not recorded within 10 seconds is refused, and a VM that loses a record halts (A sandbox VM died); 64 loops of program starts at once for 30 seconds caused neither. - 32-bit programs fail whatever the service's seccomp profile: the VM's kernel has no 32-bit entry.
- The cluster itself refuses a pod with no memory limit, a
tcpSocketprobe or aNO_PROXYof*, so a pod Hawk did not build meets those rules too.
Pick a Kata network¶
You rarely need to. Leave network out and Hawk picks lockdown for a sandbox with one
service and peer for one with several. The chart gives every sandbox a service named
default unless the task defines one, so a task whose only service has another name
counts as two and gets peer. Set network to choose yourself:
network |
Use it for | The VM reaches |
|---|---|---|
lockdown |
one service | only the named hosts over HTTP(S), and named ranges on one port each |
peer |
several services | its own services, plus the same hosts and ranges |
open |
what the proxy cannot carry, such as UDP at standard |
what the sandbox's network policy allows, as for a container |
The named hosts are the ones in isolation at strict; at standard the hosts and
ranges are the ones in the task's own sandbox definition. With network left out, a
human eval always gets peer; it refuses network: lockdown.
In an eval set that names a runtime_class, an item cannot choose another runtime:
if it names one, it must name the eval set's runtime_class and network exactly.
At standard with a runtime named
(A hardened runtime without strict), a task
that sets network_mode: bridge has the whole internet under gVisor and on Kata's
network: open. On Kata's lockdown and peer it is refused until it names its hosts
instead: allowDomains in a values.yaml, or allow_domains under
x-inspect_k8s_sandbox in a Compose file.
A sandbox VM died¶
A sample that fails with SandboxVMTerminatedError lost its Kata VM. The error names the
pod and the node and says where the node's logs are; Kubernetes itself records no reason.
Two causes leave a line in the node's log:
- Memory, the usual one. Each VM runs in its pod's memory cgroup on the node, and
that limit has to cover the guest's RAM plus the host page cache for the VM's disk.
When the disk is busy, that cache can push the pod over its limit, and the host's OOM
killer kills
cloud-hypervisor, the VM. Give the service more memory headroom than it uses, in theresourcesof the task's sandbox definition, or write less to disk at once. - Traffic. glovebox records every byte that crosses a VM's boundary (its network and
its host channel, which on
lockdowncarries all of its internet traffic) and terminates a VM whose recording passes about 8 GiB over its life. Command output and files copied in or out count too. Download large datasets or weights into the image instead of at run time. On a node running more than 4 VMs the limit can be lower: see Kata microVMs.
On lockdown and peer, a VM also halts if it loses the record of a program start, of a
ptrace call or of a write under /proc, or if its recorder stops. That happens inside the
VM and has not been produced in testing, so what the node's log shows is not known, and no
alarm covers it. Suspect it when the node's logs arrived and hold neither line below.
To find out which it was, for operators:
- Open the node's stream in the
<env>/hawk/glovebox-node-logsCloudWatch log group (the stream is named after the node). It holds the node's kernel log and the kubelet, containerd and Kata shim journals, and outlives the node. A memory kill readsMemory cgroup out of memory: Killed process <pid> (cloud-hyperviso). A recorder termination readsio_record: the recording ... past its ...-byte shareor... holds ... bytes of running recordings. - The
<env>-glovebox-VmmOomKilland<env>-glovebox-RecorderBudgetRefusalCloudWatch alarms fire on those lines. - If the logs were not shipped (the node died before its log agent started, the
deployment's Hawk version does not ship them, or it has
hawk:podLogArchiveEnabledoff, which the node logs need), the instance's console log keeps the kernel's lines for a while after the node is gone:aws ec2 get-console-output --instance-id <id> --latest --output text. Find the instance id from the node name withaws ec2 describe-instances --filters Name=private-dns-name,Values=<node>.
What every level refuses¶
Hawk rejects Inspect's local sandbox at every isolation level, including with
hawk local. Its commands would execute as the runner user with access to the
runner's credentials and files. Use a Docker or k8s sandbox for command execution.
Tasks that need no sandbox, such as text-only evaluations, may omit it at
standard. There is no opt-out for local.
Both task and sample declarations are checked independently, even when another sandbox overrides them. The runner also disables the local provider itself, so a late sandbox change or resumed eval cannot bypass the declaration check. This applies to eval and scan runners, including their spawned Inspect/Scout workers. Task and scanner Python code still runs in the runner process; this does not isolate that code or prevent it from launching subprocesses directly.
Whatever the isolation level, Hawk refuses sandbox values that would let a task reach past the container boundary, or delay sandbox shutdown beyond 30 seconds. The eval set, or in a sharded eval set the unit that holds the task, fails as it starts, before any of its samples run, with an error naming the value:
additionalResources(arbitrary manifests, templated by Helm, which could start an ordinary pod beside the sandbox),extraContainers(containers rendered as written, beside the service) andinitContainers(each runs under its own security context). An empty list is fine.annotations, and a service'spodAnnotations. Cluster components act on them outside Hawk's checks (an AppArmor profile, a volume's storage class), and Hawk sets the ones a sandbox needs. An empty map is fine.- Literal volume specs. Use the chart's
<name>:<path>shorthand, which mounts the claim that a top-levelvolumesentry of that name renders in the sandbox's own release; a custom claimspecis refused too. - A service's
terminationGracePeriodSecondsoutside0–30: a deleted sandbox could otherwise hold its node and delay eval cleanup for arbitrarily long. corednsSecurityContext,egressCapture,podGroup,serviceAccountName,serviceAccountCreate,automountServiceAccountToken,priorityClassName,egressForwarderImageandadditionalResourceDnsRecords.- Any chart value Hawk has not reviewed, so a value a chart upgrade adds is refused until someone reviews it.
- Where the deployment runs Nitro Sandboxes, a toleration of their nodes'
NoScheduletaint (inspect-ai.metr.org/nitro-sandbox, or a key-lessoperator: Exists) on a service that requests no GPU and runs under no gVisor, Kata or Nitro class.
At standard, a service's securityContext may set only
allowPrivilegeEscalation (false), appArmorProfile and seccompProfile
(RuntimeDefault only), capabilities, privileged (false), procMount
(Default), readOnlyRootFilesystem, runAsGroup, runAsNonRoot and runAsUser.
Write values as real YAML booleans and integers: privileged: yes is refused rather
than guessed at. Everything a compose file's user and security_opt produce passes,
except seccomp=unconfined and a custom profile file (seccomp=<path>, which becomes
a Localhost profile).
Networking values stay the task's to set at standard. At strict the eval set's
allow_domains and allow_requests replace the task's allowDomains, allowEntities
and allowCIDR, and a task is refused if it sets allowDomainsPorts, corednsCommand,
corednsImage, corednsUpstream, global (name overrides), networkPolicy.enabled
other than true, or a label under inspect-ai.metr.org/.
Every Kubernetes runner and sandbox namespace also enforces Kubernetes Baseline Pod Security Admission, whatever the isolation level or runtime class. It rejects privileged containers, host mounts and host namespaces even if task code creates a Pod directly. Root users and writable root filesystems remain allowed. The one exception is the sandbox namespace of an eval set that sends the whole internet or an address range through its sandboxes' nodes: there the final Pod policy below alone holds the pods, and admits only Nitro Sandboxes.
Final Pod admission checks¶
Hawk also checks every final runner and sandbox Pod at the API server, after
mutating admission has run. Direct API calls, controller-created replacements,
init containers and later ephemeral containers get the same checks. The policy
uses only namespace names to select runner and sandbox rules: within the deployment's
namespace prefix, child namespaces ending in -s receive sandbox restrictions;
the deployment namespace itself and other children receive runner restrictions.
The janitor namespace is excluded. Removing or changing namespace or Pod labels,
including PSA labels, cannot weaken these checks. The separate early Job-template
Baseline check applies only in runner namespaces already labelled for Baseline
v1.35. Older namespaces retain their existing behavior so legacy Jobs can update
and finish cleanup.
The final Pod policy uses Deny. It rejects noncompliant Pod creation and
updates, including finalizer cleanup. Existing PSA and runner Job-template
Baseline enforcement remain in place, with the one exception above. Before upgrading from warning/audit mode,
finish cleanup of incompatible Pods; see
Observing Pod policy violations.
These checks cover the container-boundary rules from the runner: no explicit
privilege escalation, unmasked proc mounts, custom AppArmor/SELinux/Windows
settings, sysctls, arbitrary seccomp profiles, raw devices or inline filesystem
drivers. Added capabilities are limited to NET_BIND_SERVICE, plus the six
capabilities Hawk gives a strict root container after dropping ALL, and NET_ADMIN for
the redirect init container
of a Nitro sandbox with no network card, whose forwarder may use its own seccomp profile. Kata's
relayed runtimes may use glovebox's exact workload seccomp profile. Sandboxes
must use the default service account with token mounting disabled; projected
tokens and mounted secrets are denied, but for a sample's
egress proxy reading its
own Secret. Runner credential mounts remain allowed.
The sandbox termination grace limit is 30 seconds, including Kubernetes' default
when the field is omitted. Hawk's sandbox chart still defaults to zero, and Hawk
sets one second for Nitro's shutdown handshake.
Kubernetes admission is the enforcement boundary. Assume task code can bypass every runner-side check and submit manifests directly. The final Pod specification has a closed schema checked by native CEL admission. A new Kubernetes field is rejected until Hawk reviews it, including through direct Kubernetes requests.
The runner also validates task sandbox values against a recursive allowlist
(extra="forbid") to give immediate, useful configuration errors. This feedback
layer covers nested resources, environment entries, probes, mounts and scheduling
settings; it contributes no security guarantee against malicious runner code.
| What an eval needs | Supported configuration |
|---|---|
| Run task code | Service images, commands, arguments, working directories and literal environment variables |
| Cooperating services | Named services, DNS records, ports and named sandbox networks, where the runtime supports peers |
| Compute | CPU, memory, ephemeral storage and NVIDIA GPU requests/limits; Kubernetes validates quantities |
| Placement | Selectors and required node affinity on reviewed architecture, instance and GPU labels (never a node's hostname); reviewed runtime classes and explicitly scoped pool tolerations |
| Files | Writable container filesystems, named shared claims through the chart's volume shorthand, and typed mount options |
| Process identity | UID/GID including root, optional non-root/read-only settings, and reviewed capability profiles |
| Health | Typed exec, HTTP, TCP or gRPC readiness/liveness probes targeting the container |
| Egress | Existing isolation-level rules for domains, CIDRs and internet access; these remain subject to network policy |
Named networks in sandbox Helm values may retain legacy driver: k8s; the chart
ignores it and networking is unchanged. Other driver values and network declaration
options are refused. Volume declarations remain empty.
Hawk supplies credential projections, runtime annotations, helper containers and
default shutdown settings. The final Pod checks cover helpers and task containers
alike; a container name grants no exemption. The contract requires Nitro's exact
metadata-denying runtime policy. Unknown annotations, lifecycle hooks, device resource types,
mount propagation, custom schedulers and wildcard tolerations are rejected. The one
lifecycle hook allowed is a postStart command, which starts execd in a task run's containers.
The contract limits Datadog log configuration annotations to runners because they
can instruct the node agent to read files outside a sandbox. Automatic container log
collection remains available when Datadog is enabled.
Sandbox probes must omit terminationGracePeriodSeconds, including on helper
containers. Failed probes inherit the Pod's shutdown grace, capped at 30 seconds.
Runner shutdown settings are separate.
Supported runtime names are unset (cluster default), nvidia (the GPU operator's
class, which GPU tasks name), gvisor, kata-open, kata-lockdown, kata-peer,
nitro and nitro-32bit; each named class must retain its approved node-pool
selector. Labels and node selectors are typed string maps,
not permissions to bypass admission. API-server status and bookkeeping are outside
the Pod specification contract.
This contract covers common Pod restrictions, not a complete implementation of strict.
Omitted security settings retain Kubernetes defaults at standard. The policy
does not force non-root, a read-only root filesystem, a runtime class or an
eval's egress grants. Namespace creation is API-owned; namespace and Pod labels
cannot select weaker runner/sandbox rules or authenticate a task. A Pod-only policy also
cannot validate a PVC's backing storage, other manifests, or which Helm values
produced a Pod. Runner validation can report mistakes in these settings early,
but cannot enforce them against malicious runner code.
In particular, a runner with namespace write permissions can still change its
Services, claims and Cilium policies. Enforcing each task's storage/network grants
against a compromised runner requires separate resource admission and trusted
policy data; the closed Pod schema does not supply that authorization.
Observing Pod policy violations¶
The final Pod policy's binding uses validationActions: [Deny]. Violations
appear in rejected API responses and controller FailedCreate events. EKS audit
logs record the rejected requests. Existing Pods may keep running while new Pods
and controller updates fail.
Before upgrading from warning/audit mode, Warn returns an HTTP warning to the
caller (kubectl prints it); controller and SDK handling varies. Audit adds
validation.policy.admission.k8s.io/validation_failure to the API audit event.
The Deny binding does not add that annotation.
Hawk enables EKS audit logging. In CloudWatch Logs, select
/aws/eks/<cluster-name>/cluster; the relevant streams start with
kube-apiserver-audit-. This Logs Insights query shows denials and earlier audit findings:
fields @timestamp, objectRef.namespace, objectRef.name, @message
| filter responseStatus.code >= 400 or @message like /validation_failure/
| filter @message like /hawk-api-pod-security/
| sort @timestamp desc
Exercise representative workloads and controller cleanup before upgrading to
enforcement. Audit events cover requests, not untouched Pods:
to inventory existing Pods, submit an unchanged server-side dry-run UPDATE for
each and record its warnings. Review noncompliant Pods with finalizers before
switching to Deny: rejection of a bookkeeping update can block Job completion
and namespace deletion. After upgrading, repeat representative launches and
completion checks and investigate any denials.
Maintaining Pod admission allowlists¶
For developers updating charts, injectors, runtime helpers, Kubernetes or Kueue:
admission checks the final Pod after mutation, on both creation and updates.
A valid Helm template can still be rejected when a controller adds an
unreviewed annotation later. Namespace selection and these checks live in
infra/hawk/pod_security.py and infra/hawk/pod_security.yaml; the recursive Pod
spec schema is hawk/hawk_flags/pod_contract.py. Exact runtime annotation values
live in hawk/hawk_flags/runtime_contract.py.
Before shipping such an update:
- Inspect the final Pod fields and annotations, including webhook mutations and later controller patches. Check the pinned upstream version's default feature gates too. Kueue, for example, annotates runner templates at admission and sandbox Pods during both creation and StatefulSet reconciliation.
- Review each new annotation's consumer and effects. Add only the required exact
keys to
pod_security.yaml, with value or workload restrictions where needed; never allow a whole prefix. Update the closed schema for reviewed spec fields. - Extend
infra/tests/test_runner_pod_security.pywith representative rendered Pods and controller mutations, covering CREATE and UPDATE as appropriate. Its Kueue cases model the pinned controller's mutations; update those cases when upstream behavior or enabled feature gates change. Keep unknown keys rejected under the emittedDenybinding, including keys under an otherwise supported prefix. Keep the Warn/Audit-to-Deny replacement and compliant Job finalizer cleanup covered. - Run that suite against a disposable Kubernetes 1.35+ cluster, with
HAWK_ADMISSION_TEST_KUBECONFIGpointing to it and the Hawk dependencies synced (uv sync --locked --directory hawk). The command isuv run --directory infra python -m pytest tests/test_runner_pod_security.py; without that environment variable the tests skip. For a new injector or controller version, also exercise its real mutations on a development cluster.
Check controller FailedCreate events and rejected patch responses after each
update, as well as the audit logs above.
Optional Linux capabilities at standard¶
Hawk permits only NET_BIND_SERVICE in sandbox capabilities.add. It allows a
container to bind ports below 1024. A task that needs it can opt in through its
sandbox values.yaml:
services:
default:
image: my-registry/task-image:v1
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
add: ["NET_BIND_SERVICE"]
Other added capabilities, including ALL, are rejected; names must match exactly,
without the CAP_ prefix. An empty or omitted add is fine. The allowlist is
maintained in Hawk's code and cannot be expanded by task configuration.
At strict, Hawk replaces service capabilities with drop: ["ALL"], removing any
requested additions, then gives root six back. On a Nitro Sandbox
it adds back NET_BIND_SERVICE unless the task drops it, which a root process there
needs to bind a port below 1024; a non-root process can't bind one, so serve on 1024 or
above. The chart's CoreDNS sidecar keeps its own hardened security context, which retains
NET_BIND_SERVICE because its binary requires that capability to start, and on a Nitro
Sandbox runs as root.
Two controls strict leaves off¶
Running as a non-root user and a read-only root filesystem are not in strict by
default, because most tasks are not built for them.
isolation:
level: strict
non_root: true # the image declares a numeric non-root USER
read_only_root: true # the task mounts scratch volumes at /tmp and the working dir
On a task that is not built for them, both fail every sample rather than degrading:
non_root: a root image does not start.read_only_root: without scratch volumes, the task cannot write where it expects to. Ask your operator before you use it. It does not work on a deployment as Hawk installs it: the scratch volumes need a storage class namednfs-csi, which Hawk does not install, and until an operator adds one a sandbox that mounts them never starts. Wherestrictruns on Nitro Sandboxes, a sandbox with these volumes runs on gVisor instead, and one that namesruntime_class: nitrois refused.
What strict sets, next, has the detail.
What strict sets¶
Shown as the Kubernetes sandbox values it produces:
services:
default:
image: my-registry/task-image:v1
runtimeClassName: gvisor # nitro where strict runs on Nitro and nothing keeps the sandbox on gVisor (see What changes on Nitro); the Kata class where the eval set names `kata`
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
# add: [SETUID, SETGID, CHOWN, DAC_OVERRIDE, FOWNER, KILL] for root
seccompProfile:
type: RuntimeDefault
runAsNonRoot: true # with `non_root`, or where the task set it
readOnlyRootFilesystem: true # with `read_only_root`, or where the task set it
# no allowDomains / allowEntities / allowCIDR -> no internet
strict does not pick a uid: under non_root the container runs as the non-root user
the image declares, by number, or as the runAsUser the task names, which is kept.
kubelet refuses to create a container that would run as root.
read_only_root needs writable scratch at /tmp and at the agent's working directory,
or even pip install fails. The task declares it, in the chart's <name>:<path> volume
shorthand:
services:
default:
volumes:
- "tmp:/tmp"
- "work:/home/agent" # adjust to your image's working directory
volumes: # the claims the shorthand mounts
tmp: {}
work: {}
The scratch needs a storage class Hawk does not install
A literal volume spec, such as emptyDir, is refused at
every level, and the shorthand's claims use the chart's
default storage class, nfs-csi. Hawk's deployed infrastructure installs no such
class (only the local minikube script defines one), so the claims stay unbound, and the
sandbox's pods never start, unless the cluster's operator adds one.
non_root and Inspect's injected tools
Inspect installs text_editor, bash_session and similar by exec'ing into the
sandbox as root, so that their files are root-owned and hidden from the agent.
Under non_root that exec cannot succeed: switching users needs CAP_SETGID, which
a non-root user doesn't have.
Inspect falls back to installing them as the sandbox's own user, so the tools still work. The tools directory is then readable by the agent, which matters only if your eval depends on the agent being unable to inspect its own tooling.
Without non_root the sandbox already runs as the user Inspect asks for, so no
switch is needed and nothing is given up.
Root capabilities¶
At strict, root keeps CAP_SETUID, CAP_SETGID, CAP_CHOWN, CAP_DAC_OVERRIDE,
CAP_FOWNER and CAP_KILL.
- A non-root user that
runuserorsuswitches to holds none and cannot regain them. - The agent holds all six whenever its tools run as root: in a root image without a
non-root
default_user, in a tool call withuser="root", and in root-run task code it can influence, such as scoring. - A service keeps none under
non_root, or when its task setsrunAsNonRoot: trueor a non-zerorunAsUser. It keeps none of the six that its task drops itself, by name or withdrop: [ALL]and no matchingadd.
Control by control¶
| Control | Default at standard |
|---|---|
| Kernel boundary | none (runc, on the node's kernel) |
| User | root (uid 0) |
| Linux capabilities | default set (no CAP_SYS_ADMIN) |
| Privilege escalation | permitted |
| Syscall filtering | runtime default profile (active) |
| Root filesystem | writable |
| Internet | denied |
| Sibling services | reachable |
Hardening lives in the task's own sandbox definition, so you can harden one task by
hand, with the values strict sets, without changing anything
globally.
Anything the agent must not reach (a scorer, a reference solution, a hidden test set)
goes in its own service with network_mode: none, which is deny-all even while the agent
service has internet. The trusted harness still reaches it, so
scoring keeps working.
What the baseline already gives you
In a default sandbox pod:
- No internet, no DNS resolution of external names, no reach to cloud metadata (IMDS), the VPC, or the Kubernetes API.
- No io_uring:
io_uring_setupfails on the default, GPU and gVisor nodes. CAP_SYS_ADMINis not held, the capability most container escapes need.mountand user-namespace creation both fail.- No container-runtime socket, no host PID or mount namespace, no host devices, no writable cgroup interface.
- SELinux enforcing with per-container MCS categories, on an immutable, minimal host OS.
- A fresh pod, disk, DNS resolver and network policy for each attempt at a sample, destroyed after it.