Skip to main content
This page documents every field in a sandbox policy. A policy is carried on a managed runner as the policy field and governs the sandboxes placed on that runner.

Top-level fields

An empty policy is valid and supplies no base defaults or explicit constraints. Platform safety gates still apply, and an absent runtime-class allowlist permits no concrete runtime_class pin. The base, constraints, and control_plane_access groups are optional. An absent source IP allowlist adds no source-address restriction.

Resolution order

A sandbox resolves in two stages:
  1. Base: Runtime defaults, then base, then the sandbox spec. The sandbox takes precedence for scalar defaults. List attachments from base are always applied, and administrator-pinned Pod metadata takes precedence when annotation keys overlap.
  2. Constraints: Clamps are validated against the fully resolved spec. A violation is rejected, never silently rewritten.
Because constraints validate the resolved spec rather than the submitted one, a value that base supplied is checked on the same terms as a value the sandbox supplied.

base

A fragment of runtime defaults and attachments. On a Kubernetes runner, this is a Pod specification fragment. base is where infrastructure settings live that a sandbox has no business declaring: the scheduler, Node selectors, tolerations, PriorityClass, topology spread, image pull Secrets, platform volumes, DNS configuration, and Pod metadata such as pinned annotations. Security-sensitive fields are rejected outright, including the following:
  • affinity
  • Pod and container securityContext.
  • runtimeClassName
  • initContainers
  • Host namespaces.
  • hostPath volumes.
  • Non-default ServiceAccounts.

control_plane_access

ControlPlaneAccessPolicy restricts Sandbox API requests that select a runner or target a sandbox placed on it. These controls supplement authentication and authorization. They don’t restrict traffic sent directly to services exposed by a sandbox.

SourceIpAllowlist

The API canonicalizes prefixes, removes duplicates, and removes prefixes covered by a broader entry. Invalid CIDRs, including zone-qualified IPv6 addresses, are rejected. 0.0.0.0/0 explicitly permits every IPv4 source. ::/0 explicitly permits every IPv6 source. Access controls are evaluated at request time, separately from create-time specification resolution. Changes apply to new operations on existing sandboxes after policy-cache propagation. Policy administration remains available to administrators regardless of the allowlist. For configuration, stream behavior, errors, and recovery, see Restrict Sandbox API access by source IP.

constraints

PolicyConstraints groups the typed clamps a policy enforces. Every group is optional. Omitting a group adds no explicit constraints of that kind, but platform safety gates and the runtime-class restrictions in SecurityConstraints still apply.

ResourceConstraints

max_cpu and max_memory bound each user container’s request. A sandbox with multiple user containers can satisfy each per-container maximum and still exceed cpu_ceiling or memory_ceiling. The memory ceiling also includes the resolved sizes of memory-backed volumes. Ceilings are policy checks on one sandbox. Placement also accounts for runtime overhead, other workloads, and available capacity. Node allocation budgets bound aggregate sandbox requests on each Node. For sizing guidance, see Size sandbox CPU and memory.

ImageConstraints

NetworkConstraints

Network constraints define allowlists for the access a sandbox can request. When a sandbox declares egress, the policy accepts or rejects that declaration without widening it. When the sandbox declares no egress, the policy applies default_egress, unless the sandbox sets deny_egress. Platform DNS and storage access are granted separately. The same constraints bound dynamic network updates. When an allowlist is non-empty, containment is checked by destination or source type and port. A declared CIDR must fit the combined allowed CIDR ranges or an any rule. A declared tenant scope requires a matching tenant rule or an any rule, while declaring any requires an any rule.

EgressRule

Each rule names exactly one destination, optionally narrowed by port. Hostname rules authorize HTTPS access, not DNS queries. When allowed_egress is non-empty, a declared hostname must fit an allowed hostname pattern, after its exclusions, or an any rule. A CIDR-only allowlist doesn’t permit hostname declarations. Put reusable hostname grants in a sandbox template, not in default_egress. dns_egress controls outbound UDP/TCP port 53 independently. DNS_EGRESS_MODE_ALLOW permits access to the platform resolver. Other resolvers require an egress rule. DNS_EGRESS_MODE_DENY blocks outbound port 53 even when another rule permits it. It doesn’t block locally answered lookups or DNS over other permitted transports, such as HTTPS.

IngressRule

Ingress rules apply to existing CUSTOM-visibility ports. They don’t change service visibility and can’t select sources by hostname or label.

CidrBlock

PortRange

TenantScope

SelectorBlock

Matching uses exact label pairs, but declarations may add labels. When the egress allowlist is non-empty, a declared selector must carry every label pair in a matching selector rule. Both selectors must omit Namespace labels, or both must include them, with the declaration carrying every required Namespace label pair. An any rule never covers selectors, but an empty allowlist permits selector declarations.

SecurityConstraints

Host namespaces aren’t configurable through v1 policy security fields. The former allow_host_network and allow_host_pid fields have been removed. For legacy v1beta2 profiles, see Example: allow a privileged profile posture. allowed_runtime_classes fails closed: an empty or absent list permits no concrete runtime_class pin. Portable class selection through runtime_class_selection uses runtime_class_mappings instead. The policy bounds the in-guest privileges a sandbox may request and the runtime classes it may select.

RuntimeClassMapping

A non-empty runtime_class_mappings list enables portable runtime class selection. Each mapped class is available for caller selection. RUNTIME_CLASS_CPU_DEFAULT and RUNTIME_CLASS_GPU_DEFAULT also supply automatic selection for their resource family. Omitting either default class turns off automatic selection for that family. Unmapped classes are unavailable, and concrete runtime_class pins are rejected. Mappings can’t be combined with allowed_runtime_classes, default_cpu_runtime_class, or default_gpu_runtime_class. Each portable class can appear at most once.

InstanceConstraints

LifecycleConstraints

The policy carries no lifetime cap. The platform maximum of 30 days bounds every sandbox: a create request above it is rejected. The max_lifetime_seconds field was removed from the policy document, and cwic rejects a policy that still carries it.

MetadataConstraints

VolumeConstraints

StorageMedium

To forbid RAM-backed volumes, set a non-empty allowed_media list containing only STORAGE_MEDIUM_DISK. An empty list permits any storage medium.

Validation rules

A policy is rejected when any of the following hold:
  • The encoded document exceeds 256 KiB.
  • The policy is null. A configured policy can’t be cleared, only replaced.
  • default_egress contains https_hostname rules.
  • Default egress or ingress rules fall outside the corresponding allowlist.
  • A source IP allowlist contains an invalid IPv4 or IPv6 CIDR, more than 256 entries, or more than 16 KiB of CIDR text.

See also

For related guidance, see the following pages:
Last modified on November 6, 2026