Expand description
Boundary newtypes shared across endpoint schemas.
Per 70-security.md § 4, every
domain primitive that crosses the HTTP boundary is wrapped in a newtype with private
fields and a fallible constructor. Validation runs once in try_from; every
downstream use is provably safe by construction.
- identifier regex allowlist:
^[A-Za-z0-9_]{1,64}$ - default string cap 256 bytes (not chars; multi-byte exhaustion is an attack)
- path cap 1024 bytes (Darwin
PATH_MAX) - UDS path cap 103 bytes (Darwin
sun_pathminus the NUL terminator) - per-class collection caps calibrated against the 32-slot virtio-MMIO budget
Structs§
- DriveId
- Validated
drive_id. Regex^[A-Za-z0-9_]{1,64}$. - IfaceId
- Validated
iface_id. Regex^[A-Za-z0-9_]{1,64}$. - Instance
Id - Validated microVM instance ID (
--id/InstanceInfo.id). Regex^[A-Za-z0-9_]{1,64}$; empty rejected. - MacAddr
- Validated 48-bit MAC address. Accepts the canonical
aa:bb:cc:dd:ee:ffshape (lowercase or uppercase), rejects anything else. - MemSize
Mib - Validated memory size in MiB. The upper bound is host-RAM-dependent and validated
at the controller against
BackendCapabilities; the type-level constraint ismem_size_mib >= 1. - Safe
Path - Validated host-filesystem path (
path_on_host,kernel_image_path, etc.). - UdsPath
- Validated UDS path (
api_sock,vsock.uds_path,mem_backend.backend_path). - VsockId
- Validated vsock ID (the upstream
vsock_idfield). Regex^[A-Za-z0-9_]{1,64}$.
Constants§
- DEFAULT_
STRING_ CAP - Default per-string byte cap for fields without an explicit override.
- MAX_
DRIVES - Maximum number of
/drivesrows in a single configuration. - MAX_
NICS - Maximum number of
/network-interfacesrows in a single configuration. - MAX_
PMEM - Maximum number of
/pmemrows in a single configuration. - MAX_
VCPU_ COUNT - Maximum vCPU count, matching upstream
MAX_SUPPORTED_VCPUSand D19. - MAX_
VIRTIO_ MEM - Maximum number of
virtio-meminstances in a single configuration. - PATH_
MAX - Path-shaped string cap (Darwin
PATH_MAX). - UDS_
PATH_ MAX - Unix-domain-socket path cap (Darwin
sun_pathsize minus the NUL terminator).
Functions§
- check_
string_ cap - Length-cap any free-form string field to
DEFAULT_STRING_CAPbytes (256), unless a per-field override is documented in the field’s spec entry.