hive-priv: refuse injecting strings in the limits drop-in and the container conf
memory_max and cpu_quota are checked against the shapes systemd takes before write_resource_limits makes any file. validate_bind_path also refuses whitespace, control bytes, backslash, dollar and backtick, which the start script expands unquoted in EXTRA_NSPAWN_FLAGS. bridge must be an interface name and gateway_ip an IPv4 literal. Each refusal names its field. Closes #6086
This commit is contained in:
parent
04870fbdb0
commit
18e4f195e5
1 changed files with 298 additions and 15 deletions
|
|
@ -326,6 +326,16 @@ known operations; there is no arbitrary command pass-through:
|
|||
| `SendAgentSnapshotToFile` | `btrfs send [-p <parent>] <snapshot>` into a bare filename under `MIGRATE_STAGING_ROOT`; refuses to overwrite an existing export |
|
||||
| `SendAgentSnapshotToFd` | `btrfs send [-p <parent>] <snapshot>` into a **file descriptor passed with the request** (`SCM_RIGHTS`). hive-c0re connects to the peer and hands over the connected socket, so hive-priv never learns an address or protocol. hive-priv requires exactly one descriptor here, and refuses one that arrives alongside any other operation |
|
||||
|
||||
**Strings that reach root-loaded config** — `WriteResourceLimits` and
|
||||
`WriteNspawnFlags` copy request strings into a systemd drop-in and an env
|
||||
file that systemd and the nixos-containers start script read, so hive-priv
|
||||
refuses, never escapes, any value outside its shape. `memory_max` is
|
||||
`infinity`, a decimal percentage or a decimal size with an optional
|
||||
`B`/`K`/`M`/`G`/`T`/`P`/`E`; `cpu_quota` is a decimal percentage; `bridge` is
|
||||
1-15 ASCII letters, digits, `-`, `_` or `.`; `gateway_ip` is an IPv4 literal. A
|
||||
bind or credential path is absolute with no whitespace, control byte, `\`,
|
||||
`$`, backtick, `"` or `:`. The size limits of a value stay with systemd.
|
||||
|
||||
**Closures from the swarm cache** — `RealiseClosure` is how a hive's rebuild
|
||||
takes the closure the swarm built instead of building it. Root-owned sources
|
||||
alone decide what root accepts:
|
||||
|
|
|
|||
Loading…
Reference in a new issue