Skip to content

Threat Model: 5-Spot ScheduledMachine Controller

Version: 1.11
Date: 2026-10-14
Status: Active — living document
Covers: ADR-0001 … ADR-0021 (the 1.11 pass covers ADR-0021 and two admission defects found while extending the e2e tier to the agents. Every section walked. ADR-0021 reduces privilege: the reclaim agent's CAP_NET_ADMIN served only the netlink detector, which cannot work outside the host's initial network namespace (measured: ECONNREFUSED from any other, even as root), and the agent policy denies hostNetwork. So the shipped agent crash-looped and the emergency reclaim control was unavailable on every Linux node (new D10, now mitigated), while holding a capability it could never use. A second, independent defect in the same path made every Node patch fail in any detector mode (bug-014), so the control had never worked. The DaemonSet now polls and adds no capability, and the policy admits no capability add for any pod: T13 is closed, not accepted. The second defect: the agent policy still required the kata agent's hostPath to be / after ADR 0005 narrowed the mount to /etc/k0s, so it rejected the shipped kata agent outright, and its stated "exact documented posture" (E5) was not the manifest's. Rule 6b now admits only /etc/k0s, tighter than before. Both are now proven against a real API server by .github/scripts/agent-pod-security.bats, which renders the shipped DaemonSets into Pods and asserts admission as well as denial. Changed: §2 diagram, §6.4 (intro, T13 closed, new D10), E5, K7, §7 (two rows updated, one new). §§1, 3, 4, 5, 8, 9, 10 unchanged.

The 1.10 pass covers ADR-0020: every runtime component is a subcommand of one 5spot binary in one image, and the Kata-config agent enters host namespaces itself instead of executing nsenter. Every section walked. No identity, RBAC grant, credential or boundary changes: each component keeps its own Deployment or DaemonSet, ServiceAccount, ClusterRole and pod security context, and every admission policy keys on ServiceAccount names, which are unchanged. What changes is what an image contains. §1, §2 (diagram, F8), §4 (TB2 and TB6 text, and the capacity boundary's stated rationale, which now names the separate process and token rather than the separate binary, since that is what the guarantee always rested on), §6.2 T9 (corrected: the claim of no unsafe code was already false before this ADR, because src/netlink_proc.rs has two unsafe blocks for raw socket fds; ADR 0020 adds none), §6.5 (restart mechanism, K2, new K6), C6, §7 (four rows), §8 (one new LOW residual) and §9 assumption 4. The restart path was verified on a real host in the actual Distroless base: host systemctl reached only through namespace entry, exit status passed through, and an unprivileged run refused rather than running in its own namespaces.

The 1.9 pass covers ADR-0019, the k0smotron end-to-end tier in kind, and bug-008, which that tier found on its first run. Every section walked. The ADR adds no runtime component, identity, credential or boundary: the tier deploys the existing system unchanged into a throwaway cluster. What it adds is on the CI side of TB0, a job with a read-only token, no secrets and no published output, that fetches pinned tools, images and provider manifests; recorded in §7 (supply chain) and, for the provider manifests that are pinned by version rather than digest, in §8. bug-008 is the security content of this pass. Every watch in the controller ran under a 30-second client read timeout against a 290-second server timeout, so a quiet watch was killed client-side and events waited for a backoff and a relist. The reactive controls were therefore slower than this document claimed: a killSwitch flip, a schedule closing, or an emergency-reclaim annotation on a Node could take a requeue interval or longer to act on, where "immediately" was written. Fixed by setting every watch's server-side timeout below the client's, with a compile-time guard; recorded as D6 (§6.2), a §7 control row, and a correction to the §8 kill-switch entry. §§1-5 and 9 unchanged.

The 1.8 pass covers ADR-0018, which replaces serde_yaml with serde-saphyr. Every section walked. The trigger that fires is "new external dependency in the build or boot path", and the effect is in the reducing direction: a C-derived YAML parser over the unmaintained unsafe-libyaml leaves the artifact that writes cluster manifests, closing RUSTSEC-2024-0449 by fixing it rather than by adding a deny.toml ignore. Scope matters and is recorded rather than overstated: 5-Spot's YAML path emits and does not ingest, so that parser was never exposed to untrusted input at runtime, and the gain is to the build and supply-chain surface, not to a runtime trust boundary. No new component, identity, credential, boundary or external call. Changed: §6 T10 (reduced, with the scope note) and §7 one new control row, that advisories are fixed and not suppressed, with ignore = [] as the standing posture. §§1-5, 8, 9 and 10 unchanged.

The 1.7 pass covers ADR-0017, which makes the Machine's bootstrap and infrastructure references follow the discovered CAPI contract shape, and the first live k0smotron end-to-end run that found it (roadmap 06). Every section walked. The serialization change itself is posture neutral: no new component, identity, credential, boundary or external call, and the API server validates the reference strictly, so a mis-shaped reference fails closed rather than producing a partly-linked Machine. §7 records it as a control on that basis. The real security content of this pass came from the second defect the same run found, which was not an ADR at all: src/labels.rs had kept the retired 5spot.eribourg.dev domain after the group was renamed, so the key the Machine and Node reverse mappings trusted sat outside RESERVED_LABEL_PREFIXES and was therefore injectable through machineTemplate.labels. T2's mitigation was incomplete for that whole period and now says so rather than continuing to claim a clean block; new T12 records the tracking-label confusion surface, its same-namespace bound, and the drift guards. §8's bootstrapSpec residual is widened, again with no new class: the new confinement page documents putting host files, systemd units and preStartCommands through that same opaque blob, which the bootstrap provider runs as root on the worker, so the exposure is write-side as well as read-side and the existing get/list workaround does not cover it. Changed: §6.1 T2 and new T12, §7 two control rows, §8 the bootstrapSpec residual. §§1-5, 9 and 10 unchanged: the confinement described in roadmap 06 is operator-side host configuration carried as data, not a new 5-Spot component or boundary.

The 1.6 pass covers ADR-0016, which reshapes how the capacity controller actuates: 5-Spot now creates and owns the capacity object instead of patching a consumer's. Every section walked, and this is the largest change to TB7 since it was introduced, in both directions. Removed: the confused-deputy surface, because there is no longer a user-chosen field path into an object someone else owns. C1 is retained as a superseded row rather than deleted, so a reader can check the surface was designed away rather than quietly dropped, and C2's impact drops from High to Low. Added: create on the allowlisted group, which is a strictly wider grant than ADR 0011's patch and is recorded as such rather than buried, plus three new threats, C10 (the opaque spec.template instantiated by 5-Spot's credential), C11 (adopting a same-named object 5-Spot does not own) and C12 (force-apply, sound only in pairing with C11). Still no delete verb anywhere: removal is owner-reference garbage collection, which is how the "only objects you created" constraint is obtained without a grant RBAC could not scope. Changed: §1 scope, §2 overview diagram and flows F8/F9, §3 two assets, §4 TB7 diagram and all four of its defining properties, §5 one actor reworded and one added, §6.6 header plus C1-C4, C6, C7 and three new rows, §7 seven control rows, §8 four residuals (two new, one HIGH: the opaque template is a second instance of the bootstrapSpec residual, not a new class), §9 assumption 8 reworded and assumptions 9 and 10 added. §10 unchanged.

The 1.5 pass covers ADR-0015, the dependency internalization policy. Every section walked. It is a process decision with a real posture effect in both directions, so §6 T10 and the §7 supply-chain table now state the trade explicitly: each dependency removed is one fewer upstream to compromise, and one fewer component the SBOM-driven controls report on. A new LOW residual records the current exposure (19 lines). No component, asset, actor or boundary changes. The 1.4 pass covers ADR-0014: a host-governance conflict now drives capacity to zero instead of refusing to write. Every section was walked. Changed: §6.6 C5 from "mitigated with a known gap" to mitigated, and §8's MEDIUM residual removed rather than reworded, because the gap is closed rather than accepted, replaced by a LOW in the other direction. No component, asset, actor or boundary changes: the same writer writes the same field, only the value chosen in one branch differs. The 1.3 pass implements ADR-0011, which was Accepted but unimplemented at 1.2: a second controller identity and the first boundary where 5-Spot writes an API group it does not own. Every section was walked. Changed: §1 scope (a second binary, a second CRD, and the consumer declared out of scope), §2 overview and flows F8/F9, §3 three assets, §4 TB7 and its diagram, §5 two actors, §6.6 with nine threats, §7 seven controls, §8 two residuals, §9 two assumptions. §10 unchanged.)
Classification: Public. This page ships in the published documentation site (docs/mkdocs.yml → Security → Threat Model) of a public repository. It states the posture — what is defended, from whom, with which control in which file. Specific unremediated findings do not belong here; report those privately per SECURITY.md.


1. Document Scope

This threat model covers the 5-Spot controller — a Kubernetes operator that manages the lifecycle of physical machines in k0smotron-backed CAPI clusters based on configurable time schedules.

It identifies assets, trust boundaries, threat actors, per-component STRIDE threats, current mitigations, and residual risk. It is intended to inform security reviews, deployment hardening decisions, and future development.

In scope: - The controller process (5spot, the default controller subcommand) and its Kubernetes RBAC surface - The capacity controller process (5spot capacity-controller, Deployment 5spot-capacity-controller) and its separate RBAC surface (ADR 0011); one binary and image with every other component (ADR 0020) - The ScheduledMachine and ScheduledCapacity Custom Resource Definitions and their admission paths - All Kubernetes API interactions (CAPI Machine, Bootstrap, Infrastructure, Nodes, Pods), and the create plus single-field scale of a 5-Spot-owned object in an allowlisted API group (ADR 0016) - The metrics (/metrics) and health (/healthz, /readyz) HTTP endpoints of both controllers

Out of scope: - The underlying k0smotron / CAPI infrastructure providers - The capacity consumer: everything done with the capacity 5-Spot declares, and the consumer's reconciliation of the object 5-Spot owns. 5-Spot creates the object, writes a number into it and waits; claim binding, guest isolation, drain and the re-parenting of in-use resources belong to the consumer (ADR 0011, ADR 0016, §9 assumptions 7 and 9) - The physical machines being managed - The Kubernetes API server itself - Network-level threats (CNI, firewall policy)


2. System Overview

flowchart TB User(["User / CI-CD"]) subgraph cluster["Kubernetes Cluster"] subgraph capctrl["5-Spot Capacity Controller Pod (opt-in)"] CC["Capacity Controller Process\n(5spot capacity-controller)"] end subgraph ctrl["5-Spot Controller Pod"] C["Controller Process\n(5spot controller)"] M[":8080 /metrics"] H[":8081 /healthz · /readyz"] end subgraph input["User Input — ScheduledMachine CR"] SM["bootstrapSpec · infrastructureSpec\nschedule · machineTemplate\nkillSwitch · gracefulShutdownTimeout"] end subgraph api["Kubernetes API Server"] CAPI["CAPI Resources\n(Machine · Bootstrap · Infra)"] NP["Nodes / Pods"] end Prom(["Prometheus"]) Probes(["Liveness / Readiness Probes"]) end User -->|"F1 · HTTPS + RBAC\nkubectl apply"| SM SM -->|watch events| C C -->|"F2 · watch/reconcile\nservice account JWT"| api C -->|"F3 · create / delete"| CAPI C -->|"F4 · cordon / evict"| NP SM -.->|ownerRef| CAPI CC -->|"F9 · create + scale an owned object\n(allowlisted group)"| api Prom -->|"F5 · HTTP scrape"| M Probes -->|"F6 · HTTP"| H

Key Data Flows

Flow Description Protocol Auth
F1 User → API Server: create/update ScheduledMachine HTTPS Kubernetes RBAC
F2 Controller → API Server: watch ScheduledMachine events HTTPS/Watch Service account JWT
F3 Controller → API Server: create/delete CAPI resources HTTPS Service account JWT
F4 Controller → API Server: cordon Node, evict Pods HTTPS Service account JWT
F5 Prometheus → Controller: scrape metrics HTTP (no TLS) None (cluster-internal)
F6 Kubernetes probes → Controller: health checks HTTP (no TLS) None (cluster-internal)
F7 Controller → Node: stamp the kata-config-ref annotation naming the workload-cluster source object HTTPS Service account JWT
F8 Capacity Controller → API Server: watch ScheduledCapacity, its spot-schedule provider and the object it owns HTTPS/Watch Capacity service account JWT (separate identity)
F9 Capacity Controller → API Server: create, then server-side apply, an object it owns in an allowlisted API group, scaling one numeric field in it. Never delete: removal is owner-reference garbage collection, under kube-controller-manager's identity (ADR 0016) HTTPS Capacity service account JWT (separate identity)
F8 Kata-config agent → workload API: get the named ConfigMap/Secret, then write /etc/k0s/containerd.d/kata.toml on the host and restart a systemd unit from inside host PID 1's namespaces (5spot nsenter, ADR 0020) HTTPS, then host namespaces Per-pod service account JWT, then host PID 1
F9 Reclaim agent → Node: write the three reclaim annotations HTTPS Per-pod service account JWT

3. Assets

Asset Sensitivity Description
Physical machine availability Critical Machines being added/removed from cluster; unintended removal causes workload disruption
CAPI cluster integrity Critical Bootstrap and infrastructure resources that define cluster membership
Node workloads High Running pods that could be evicted during a drain operation
Controller service account credentials High JWT token granting cluster-wide RBAC privileges
ScheduledMachine spec data Medium Contains infrastructure topology (addresses, ports, SSH config)
Kubernetes RBAC posture High Overly broad permissions on the service account expand blast radius of compromise
Cluster-wide node state High Cordon/drain operations affect all workloads on targeted nodes
ScheduledCapacity spec data Medium Declares the kind of object 5-Spot creates and the whole of its spec, through the opaque spec.template pass-through. ADR 0011's confused-deputy surface (a user-chosen field path into a stranger's object) is gone; what replaces it is a user-supplied spec that 5-Spot's credential instantiates, the same shape as bootstrapSpec.spec and carrying the same residual (§6.6 C10, §8)
Conceded host capacity High The slice of a host handed to a consumer while it stays in the cluster. Over-provisioning starves the incumbent workload the host exists to run; under-provisioning or a missed handback silently wastes it
Capacity controller service account credentials Medium JWT granting create and patch on one allowlisted API group and its own CRD's status. Still deliberately lower sensitivity than the machine controller's: no Secret access, no CAPI verbs, and no delete anywhere. ADR 0016 widened it from patch to create plus patch, which is a real widening and is treated as one (§6.6 C6, C10, C11)

4. Trust Boundaries

flowchart LR User(["User / CI-CD"]) subgraph TB1["TB1 · Kubernetes Admission Boundary"] direction TB AW["CRD schema validation\n(admission webhooks)"] SM["ScheduledMachine CR"] AW --> SM end subgraph TB2["TB2 · Controller Pod Boundary"] direction TB Bin["5spot binary\n(controller subcommand)"] SA["Service Account JWT\n(implicitly trusted by API server)"] Bin --- SA end subgraph TB3["TB3 · Namespace Boundary"] direction TB NS["Namespaced CAPI Resources\n(Bootstrap · Infra · Machine)"] end subgraph TB4["TB4 · Cluster-to-Node Boundary"] direction TB Nodes["Kubernetes Nodes\n(cordon · drain · evict)"] end subgraph TB5["TB5 · Node-Side Reclaim Agent"] direction TB Agent["5spot-reclaim-agent\n(opt-in DaemonSet pod)"] AgentSA["Per-pod ServiceAccount\n(nodes:get,patch · cm:get,list,watch)"] Caps["UID 0 + hostPID, no added capability\n+ host /proc + /etc/machine-id"] Agent --- AgentSA Agent --- Caps end subgraph TB6["TB6 · Node-Side Kata-Config Agent"] direction TB KAgent["5spot-kata-config-agent\n(opt-in DaemonSet pod)"] KSA["Per-pod ServiceAccount\n(nodes:get,patch · cm/secret:get)"] KCaps["privileged + hostPID\n+ hostPath /etc/k0s"] KHost["F8 · Host: kata.toml drop-in\n+ systemd unit restart via setns into PID 1"] KAgent --- KSA KAgent --- KCaps KAgent --> KHost end subgraph TB7["TB7 · Foreign API Group Write"] direction TB CapCtl["5spot-capacity-controller\n(opt-in Deployment)"] CapSA["Own ServiceAccount\n(create + patch on allowlisted group\nNO delete anywhere · no secrets · no CAPI)"] Target["F9 · 5-Spot-owned object\n(created, then scaled by SSA)"] CapCtl --- CapSA CapCtl --> Target end User -->|"F1 · HTTPS + RBAC"| TB1 TB1 -->|"F2 · watch"| TB2 TB2 -->|"F3 · create/delete"| TB3 TB2 -->|"F4 · cordon/evict"| TB4 TB2 -->|"F5 · per-node CM project"| TB5 TB5 -->|"F6 · annotate own Node"| TB4 TB2 -->|"F7 · stamp kata-config-ref"| TB6 TB1 -->|"F8 · watch ScheduledCapacity"| TB7

TB7 is the only place 5-Spot writes outside the CAPI API family (ADR 0011, reshaped by ADR 0016). The capacity controller creates and owns an object in an allowlisted group and scales one numeric field on it, so a spot schedule can gate a bounded slice of a host that stays in the cluster.

ADR 0016 changed this boundary in both directions, and both halves matter. Removed: there is no longer a shared object at all. ADR 0011's boundary reached into an object a stranger owned, with a user-supplied field path aimed at it, which is what made C1 and C2 the headline threats here. Owning the object deletes that surface rather than bounding it. Added: the ability to construct an object of an allowlisted kind, which is strictly more than moving one integer. TB7 is therefore now the same kind of boundary as TB3, where 5-Spot creates and owns a resource on a schedule, differing in two ways: the group is a consumer's rather than CAPI's, and nothing here is ever deleted by 5-Spot.

Four properties define the boundary, and each is a deliberate narrowing rather than an accident of implementation:

  • A separate identity. Its own process, Deployment and ServiceAccount, so the grant cannot compound the machine controller's. Compromising the capacity controller cannot delete a CAPI Machine; compromising the machine controller cannot write capacity. This is the whole reason ADR 0011 rejected a second reconciler inside the existing controller process, which would have shared its token, and it is why the two HIGH residuals in §8 do not grow. ADR 0020 makes the capacity controller a subcommand of the same binary; that changes nothing here, because the guarantee comes from the separate process and token, never from the code in the image.
  • create and patch are the only write verbs, on an allowlisted API group, with no delete anywhere, no Secret access and no CAPI verbs (deploy/capacity-controller/clusterrole.yaml). The absence of delete is the load-bearing part: RBAC cannot express "only objects you created", so a delete grant on the group would also let a compromised controller destroy a consumer's own object of the same kind. Owner-reference garbage collection achieves the removal instead, under kube-controller-manager's identity, and only ever removes objects that actually carry 5-Spot's reference (ADR 0016 decision 6).
  • Nothing is written that 5-Spot did not create. Before any write the reconciler requires an existing object to carry a controller ownerReference whose uid is this ScheduledCapacity's, and refuses otherwise with TargetNotOwned (src/reconcilers/scheduled_capacity.rs::is_owned_by). This is the write-side half of the constraint RBAC cannot express, and it is what makes the force-apply safe: by the time the controller applies, the object is known to be its own. See §6.6 C11.
  • The capacity field is no longer user input into a stranger's object. spec.capacity.field is a path relative to the spec of an object 5-Spot built, so metadata. and status. are unexpressible rather than rejected. The user-supplied surface that remains is spec.template, the whole of the owned object's spec, treated as the bootstrapSpec pass-through it mirrors. See §6.6 C10.

A cluster with no capacity consumer installs none of TB7.

TB6 is the highest-privilege boundary in the system. The kata-config agent is the only component that runs privileged: true, and its work, writing a containerd drop-in to the host filesystem and restarting a host systemd unit from inside host PID 1's namespaces, is node-root by construction (ADR 0002, ADR 0003, ADR 0020). It crosses from the Kubernetes API into the host's mount, UTS, IPC, network and PID namespaces. Everything in §6.5 follows from that.


5. Threat Actors

Actor Capability Motivation
Malicious tenant Can create/edit ScheduledMachines in their namespace Escape namespace, disrupt other tenants, exfiltrate data
Compromised CI/CD Can push images or apply manifests Backdoor controller binary, escalate privileges
Compromised controller pod Has the controller's service account Lateral movement to CAPI resources, node disruption
Rogue operator Internal user with broad kubectl access Misuse kill switch, drain nodes during business hours
Supply chain attacker Can inject into upstream crates (kube-rs, serde, etc.) RCE inside controller, credential theft
Spot-schedule provider (untrusted CRD) Owns status.active of a spotschedules.5spot.finos.org object referenced by a ScheduledMachine Flap the referenced machines on/off — effectively the same control surface as spec.enabled
Compromised capacity controller pod Has the capacity controller's service account: create and patch on the allowlisted target group and patch on its own CRD's status, read-only elsewhere Starve or over-provision the conceded capacity, or construct an arbitrary object of an allowlisted kind (new with ADR 0016, C10). Cannot delete a CAPI Machine, read a Secret, or delete anything at all: the separation from the machine controller and the absent delete verb are the controls
ScheduledCapacity author Can create a ScheduledCapacity in their namespace, choosing the kind of object 5-Spot creates and supplying the whole of its spec via spec.template Changed by ADR 0016. The confused-deputy motive is gone: there is no longer a user-chosen path into an object the author cannot reach. What remains is having 5-Spot's credential instantiate a spec the author wrote, in an allowlisted group, which is the bootstrapSpec shape (C10)
Owner of a same-named object in the target group Can create an object in the capacity controller's namespace under the name a ScheduledCapacity will derive Have 5-Spot adopt and overwrite it, or block the capacity from ever being declared. Mitigated by the uid-matched ownership check (C11), which makes the second outcome the only one available

6. STRIDE Threat Analysis

6.1 ScheduledMachine Custom Resource (Trust Boundary: TB1)

Spoofing

ID Threat Likelihood Impact Status
S1 User crafts a ScheduledMachine that mimics another tenant's resource name to confuse monitoring/alerting Low Low Accepted — names are unique within namespace
S2 Attacker spoofs ownerReference UID to claim ownership of existing resources Low Medium Mitigated — UID is set server-side by the controller, not from user input

Tampering

ID Threat Likelihood Impact Status
T1 Cross-namespace resource creation — user sets bootstrapSpec.metadata.namespace to kube-system High Critical Mitigated (2026-04-08, hardened 2026-05-30) — controller always uses the SM's own namespace; metadata.namespace/metadata.name are now loudly rejected at admission (VAP rules 13c–13f) and at reconcile (validate_embedded_metadata()). Only metadata.labels/metadata.annotations are accepted, reserved-prefix-checked
T2 Label injection: user sets machineTemplate.labels["cluster.x-k8s.io/cluster-name"] to redirect machine to attacker-controlled cluster High Critical Mitigated (2026-04-08, gap closed 2026-10-09): validate_labels() blocks reserved prefixes. The allowlist was incomplete until 2026-10-09: RESERVED_LABEL_PREFIXES covered 5spot.finos.org/ while src/labels.rs still watched and trusted the retired 5spot.eribourg.dev/ domain, so the one key the Machine and Node reverse mappings read was itself injectable (see T12). Both now name the same constant
T3 Annotation injection — user injects kubectl.kubernetes.io/restartedAt to trigger rolling restarts Medium Medium Mitigated (2026-04-08) — same prefix allowlist
T4 apiVersion/kind injection — user sets bootstrapSpec.kind: ClusterRole to create RBAC resources High High Mitigated (2026-04-08) — validate_api_group() enforces allowlist
T5 User injects malicious content into bootstrapSpec.spec or infrastructureSpec.spec targeting provider vulnerabilities Medium High Partially mitigated — spec content is passed opaquely to providers; provider-side validation is out of scope
T6 Timezone log injection — user injects newlines/control chars into timezone field to poison structured logs Low Low Mitigated (2026-04-08) — CRD schema enforces pattern: ^[A-Za-z][A-Za-z0-9_+\-/]*$ and maxLength: 64
T7 Duration overflow — user sets gracefulShutdownTimeout: "9999999999999h" causing integer overflow Medium High Mitigated (2026-04-08) — checked_mul + MAX_DURATION_SECS = 86400 cap
T8 User updates ScheduledMachine spec after machine is active, changing clusterName mid-lifecycle Medium Medium Residual risk — spec changes trigger reconciliation; no immutability enforcement on clusterName
T8a Provider-driven activation control — a compromised or buggy spot-schedule provider flips status.active, starting/stopping the machines that reference it Medium Medium Mitigated (2026-06-14) — blast radius equals editing spec.enabled and is bounded to same-namespace SMs that explicitly named the provider (cross-namespace refs are forbidden by design); controller RBAC is read-only (get/list/watch) on spotschedules.5spot.finos.org — it can never write a provider object; the provider group is CEL-pinned at the CRD field, in the VAP (rule 4), and at reconcile (validate_activation_source()). Auditable via status.spotSchedule (resolved/reason/message) + fivespot_spot_schedule_* metrics (ADR 0006)
T12 Tracking-label confusion: user sets the controller-owned scheduled-machine label through machineTemplate.labels, so a Machine they influence maps back to a ScheduledMachine of their choosing and drives its reconcile Low Medium Mitigated (2026-10-09): the key the reconciler stamps and the key main watches are now one constant (labels::LABEL_SCHEDULED_MACHINE aliases constants::SCHEDULED_MACHINE_LABEL), so it is covered by RESERVED_LABEL_PREFIXES and validate_labels() rejects it. Previously the watched key carried the retired API group and was outside the allowlist. Blast radius was bounded to the user's own namespace (the mapping requires a namespace and resolves same-namespace only) and to triggering a reconcile, not to changing its outcome. Pinned by three drift-guard tests in src/labels_tests.rs plus a corrected imposter-label test in src/reconcilers/helpers_tests.rs

Repudiation

ID Threat Likelihood Impact Status
R1 No audit trail when kill switch is activated Medium High Residual risk — Kubernetes audit log captures the CR edit, but controller logs only emit a single line; no structured event emitted
R2 No record of which schedule window caused machine removal Low Low Accepted — status conditions record transition timestamps

Information Disclosure

ID Threat Likelihood Impact Status
I1 Error messages in ReconcilerError echo user-provided values (timezone, duration, API groups) verbatim Low Low Residual risk — these are operator-visible logs, not exposed to end users; impact limited
I2 bootstrapSpec.spec may contain infrastructure addresses, credentials, or SSH keys in plaintext High High Residual risk — see Section 8
I3 ScheduledMachine status exposes nodeRef, machineRef — leaks infrastructure topology to namespace readers Low Low Accepted — intentional observability; readers in the same namespace are trusted

Denial of Service

ID Threat Likelihood Impact Status
D1 Attacker creates thousands of ScheduledMachines to overwhelm the controller reconciliation queue Medium Medium Partially mitigated — Kubernetes resource quotas and admission webhooks can cap CR count; controller has CPU/memory limits
D2 Finalizer hang — drain operation never completes, blocking namespace deletion indefinitely Medium High Mitigated (2026-04-08) — tokio::time::timeout(600s) wraps finalizer cleanup
D3 Attacker crafts an oversized ScheduledMachine CR to slow admission validation Low Low Mitigated — daysOfWeek/hoursOfDay arrays now live on the TimeBasedSpotSchedule CRD (validated by its own schema, ADR 0009), not on the ScheduledMachine VAP; Kubernetes limits CR size in either case
D4 User triggers kill switch repeatedly causing rapid machine add/remove cycles (thrashing) Low Medium Accepted — kill switch is write-once-by-design; no automatic reactivation
D5 Provider flapping — a spot-schedule provider toggles status.active rapidly, churning expensive machine create/delete cycles Low Medium Partially mitigated (2026-06-14) — transitions are bounded by the controller's reconcile back-off and the machine lifecycle's own grace/drain timers; fivespot_spot_schedule_transitions_total exposes the flap rate for alerting (see monitoring). A per-SM minimumStateDuration debounce is recorded as future work in ADR 0006

Elevation of Privilege

ID Threat Likelihood Impact Status
E1 Attacker uses apiVersion: rbac.authorization.k8s.io/v1, kind: ClusterRole to create RBAC resources via controller High Critical Mitigated (2026-04-08) — API group allowlist
E1a Escalation through the controller — user who can create a ScheduledMachine but not the embedded bootstrap/infrastructure resource has the broadly-permissioned controller create it on their behalf High High Mitigated (2026-05-29) — VAP authorizer rules (13a/13b) require the requesting user to hold create on the embedded GVKs; controller's own SA independently gated at reconcile by ensure_can_create() (SelfSubjectAccessReview)
E2 Compromised controller pod gains cluster-wide node cordon/drain, CAPI write access Medium Critical Partially mitigated — k0smotron.io RBAC narrowed; bootstrap/infra still use wildcards (provider-agnostic requirement)
E3 Controller service account token stolen from pod filesystem Low Critical Mitigated — read-only root filesystem; token mounted at standard path (Kubernetes default); no projected service account with long lifetime

6.2 Controller Process (Trust Boundary: TB2)

Spoofing

ID Threat Likelihood Impact Status
S3 Attacker replaces controller image with backdoored binary Low Critical Residual risk — mitigated by image signing (release workflow uses Cosign); IfNotPresent pull policy means in-cluster image is trusted

Tampering

ID Threat Likelihood Impact Status
T9 Memory corruption in unsafe Rust code or via malformed serde input Very Low Critical Mitigated: safe Rust except two unsafe blocks in src/netlink_proc.rs that wrap a raw socket fd into an OwnedFd (rung-2 reclaim detector, Linux only), each scoped to that call; the namespace entry added by ADR 0020 uses the safe nix::sched::setns and adds none (corrected in 1.10: earlier versions said there were no unsafe blocks at all); serde handles malformed input with errors
T10 Supply chain attack via malicious crate version Low Critical Residual risk: mitigated by Grype container scan (VEX-aware) in CI; no automated dependency pinning beyond Cargo.lock. ADR 0015 cuts both ways here: every dependency removed is one fewer upstream that can be compromised, and also one fewer component a scanner reports on, because internalized code leaves the SBOM. The 500-line bound and the test requirement are what keep the second effect small; see the §7 supply-chain note and §8. Reduced 2026-10-13 (ADR 0018): the YAML emitter is now safe Rust (serde-saphyr) instead of a C-derived one (serde_yaml over the unmaintained unsafe-libyaml), removing a memory-unsafe parser from the artifact that writes cluster manifests. Scope note: 5-Spot's YAML path emits rather than ingests, so this parser was never exposed to untrusted input in production, and the gain is to the build and supply-chain surface rather than to a runtime boundary

Information Disclosure

ID Threat Likelihood Impact Status
I4 /metrics endpoint accessible without authentication Medium Low Accepted — metrics contain no secrets; exposes operational data only; restricted to cluster network
I5 Service account token exposed via RUST_LOG=trace debug output Low Medium Residual risk — RUST_LOG=debug set in deployment; kube-rs does not log JWT tokens; verify before production

Denial of Service

ID Threat Likelihood Impact Status
D5 Pod eviction during drain exhausts Kubernetes API rate limits (429 responses from PDB) Medium Medium Mitigated — evict_pod handles 429 gracefully and logs a warning rather than crashing
D6 Delayed reaction to reactive controls: watch events reach the controller minutes late, so a killSwitch, a closing schedule, or an emergency-reclaim annotation is acted on only at the next requeue or relist Was certain (every quiet watch, on a fixed 30s cadence) High Mitigated (2026-10-13, bug-008): every watch uses stream::watch_config(), whose server-side timeoutSeconds (WATCH_TIMEOUT_SECS, 20s) is below the client read timeout (K8S_API_TIMEOUT_SECS, 30s), so the apiserver ends each watch cleanly and kube-runtime resumes from the last resourceVersion without loss. Compile-time guards in src/constants.rs fail the build if the inequality is broken; src/stream_tests.rs pins the config; the k0smotron e2e tier (ADR 0019) measures it end to end. The defect was invisible to every lower tier and had been misread as routine reconnect noise

6.3 Node Drain Path (Trust Boundary: TB4)

Tampering

ID Threat Likelihood Impact Status
T11 Attacker creates ScheduledMachine whose clusterName matches a production cluster, triggering drain of production nodes outside schedule Medium Critical Partially mitigated — clusterName is used only as a label on the created CAPI Machine; actual drain targets the node resolved via the Machine's nodeRef

Denial of Service

ID Threat Likelihood Impact Status
D6 Grace period expires mid-drain; pods are forcefully killed without completing shutdown hooks Medium Medium Accepted — POD_EVICTION_GRACE_PERIOD_SECS = 30 is configurable via constant; PDB protection applies
D7 Api::all() for Nodes/Pods fetches cluster-wide list; maliciously large cluster could cause memory spike Low Low Accepted — field selector spec.nodeName=<node> scopes pod list to one node

6.4 Reclaim Agent (Trust Boundary: TB5)

The node-side 5spot-reclaim-agent DaemonSet runs on opted-in worker nodes only and signals the controller via three Node annotations. It is the lowest-trust component in the system: pod runs as UID 0 with hostPID: true, host /proc mount, host /etc/machine-id mount, and no added capability: it polls /proc, and CAP_NET_ADMIN was removed with the netlink detector it served (ADR 0021). Per-pod ServiceAccount grants only nodes: get,patch cluster-wide and configmaps: get,list,watch in 5spot-system.

Spoofing

ID Threat Likelihood Impact Status
S5 Attacker with update daemonsets overrides the agent pod's NODE_NAME env var, causing the agent to PATCH reclaim annotations on a victim Node it isn't actually running on Low (precondition is cluster-admin-equivalent in most clusters) High (would trigger emergency-remove on innocent host) Mitigated — host-identity verification (read_host_machine_id + compare_machine_ids, security-audit Phase 4, 2026-04-26): agent reads /etc/machine-id from a hostPath.type: File mount at startup and refuses to PATCH a Node whose status.nodeInfo.machineID doesn't match. --skip-host-id-check opt-out exists but defaults off.
S6 Compromised pod somewhere else in the cluster spoofs the reclaim annotations directly on a Node, triggering an emergency-remove the agent never decided on Low High Partially mitigated — nodes: patch is broadly held in most clusters (kubelet itself has it); the controller treats the annotation as authoritative. Mitigation: monitor 5spot.finos.org/reclaim-requested PATCH events via API audit logs, alert when the field manager is anything other than 5spot-reclaim-agent.

Tampering

ID Threat Likelihood Impact Status
T12 Compromised agent escalates to other Nodes via stolen ServiceAccount token Low (per-pod SA, scoped credentials) Medium Mitigated — RBAC: nodes: get,patch cluster-wide (no list/watch — can't enumerate). Host-identity check refuses any PATCH against a Node whose machineID doesn't match the agent's own /etc/machine-id.
T13 CAP_NET_ADMIN (granted for rung 2 netlink) is misused to send rogue netlink messages on other subsystems n/a n/a Closed (2026-10-14, ADR 0021). The capability is gone: the netlink proc connector delivers only to the host's initial network namespace, which an agent pod never is (the agent policy denies hostNetwork), so the grant could never be used. The DaemonSet adds no capability (deploy/node-agent/daemonset.yaml), and the agent policy's rule 7 now admits no capability add for any pod in 5spot-system (deploy/admission/agent-pod-security-policy.yaml), proved by .github/scripts/agent-pod-security.bats

Repudiation

ID Threat Likelihood Impact Status
R1 Agent PATCH on the Node is indistinguishable from controller writes in audit logs Low Low Mitigated — the agent uses field manager 5spot-reclaim-agent; the controller uses the distinct field manager 5spot-controller-reclaim-agent. Every Node PATCH carries the field manager in managedFields, so audit attribution is unambiguous (NIST AU-2 / AU-10).

Information Disclosure

ID Threat Likelihood Impact Status
I3 Reading host /proc/<pid>/cmdline for matching exposes argv strings (which can include passwords / tokens passed on the command line) to the agent's logs Low (logs are operator-owned) Low Accepted — the agent logs matched_pattern (the operator-supplied pattern) and the matched pid, NOT the full cmdline. Patterns themselves are operator-authored config, not user input.

Denial of Service

ID Threat Likelihood Impact Status
D8 User repeatedly re-enables a SM whose conflicting process is still running, generating an ejection loop Medium Low Mitigated — loop-protection: ≥3 reclaims for the same SM within 10 minutes emits a RapidReReclaim Warning Event and bumps fivespot_rapid_re_reclaims_total{namespace, name}. Operator runbook in troubleshooting covers the response.
D9 Heavy-exec workload (make -j32) overwhelms the netlink subscriber's recv loop with PROC_EVENT_EXEC traffic Low Low No longer applicable to the shipped agent (it polls, ADR 0021); kept for an operator who runs netlink in the host network namespace. Accepted there: agent CPU is bounded by container limits (50m); ENOBUFS on the netlink socket surfaces as NetlinkError::Io and is logged, not silently dropped. Operators who anticipate exec storms should pin --detector=poll.
D10 The emergency reclaim control is unavailable: the shipped reclaim agent crash-loops, so a killIfCommands match is never reported Was certain on Linux High Mitigated (2026-10-14, ADR 0021 and bug-014). Two independent causes, either sufficient. (1) auto chose netlink, which cannot open in a pod's network namespace, and the agent exited; now auto falls back to /proc polling (DetectorFlag::resolve_with) and the DaemonSet pins poll. (2) Even with a working detector, every Node patch was refused client-side, because a forced server-side-apply parameter was paired with a merge patch, so a match never reached the controller in any mode; now a plain merge patch with a field manager (annotation_patch_params, tested through kube's own request builder). Both in src/cmd/reclaim_agent.rs; the k0smotron e2e tier (ADR 0019) drives a real process match on a node through to the emergency removal

Elevation of Privilege

ID Threat Likelihood Impact Status
E4 hostPID: true lets the agent see all host PIDs — could be abused to extract data from another container's /proc/<pid>/environ if the agent is compromised Low Medium Accepted — hostPID is architecturally required (the agent's job is to read host process state). Mitigated by: opt-in nodeSelector (only on nodes with killIfCommands), single-purpose binary with no shell, readOnlyRootFilesystem: true, drop ALL caps + add only NET_ADMIN, seccompProfile: RuntimeDefault. Trivy / Semgrep suppressions in .trivyignore document the architectural-necessity reasoning.
E5 Abuse of the namespace-wide pod-security exemption: the privileged agents require 5spot-system to be exempted from the cluster's PSA/Gatekeeper/Kyverno baseline; any principal with create pods in the namespace (compromised CI, typo'd Deployment) could then run privileged / mount the host root with no admission check Medium Critical Mitigated (2026-06-10, ADR 0004): 5spot-agent-pod-security deny-by-default ValidatingAdmissionPolicy re-imposes the baseline inside 5spot-system: risky attributes pinned to the two agent ServiceAccounts at their exact documented posture (hostPath clamped per agent: /etc/k0s for the kata agent, /proc and /etc/machine-id for the reclaim agent; no capability adds since ADR 0021; privileged to the kata agent only), compensating controls mandatory, hostNetwork/hostIPC and risky ephemeral containers denied outright, failurePolicy: Fail. Corrected 2026-10-14: until then the kata hostPath clamp still required / after ADR 0005 moved the mount to /etc/k0s, so the policy rejected the shipped kata agent and its "exact documented posture" was not the manifest's; the clamp is now /etc/k0s, and .github/scripts/agent-pod-security.bats asserts the shipped agents are admitted. Residual: a principal who can both create pods and use an agent SA wears the exception: clamped to the agents' documented posture; SA RBAC is the control.

6.5 Kata-Config Agent (Trust Boundary: TB6)

The node-side 5spot-kata-config-agent DaemonSet delivers a Kata containerd drop-in to opted-in workload-cluster nodes (ADR 0002) and restarts the host k0s service so containerd reloads it (ADR 0003). It is the only component that runs privileged: true. Its input is the 5spot.finos.org/kata-config-ref annotation the controller stamps on the Node (F7): a compact JSON object naming the workload-cluster namespace, kind, object name, data key, and the systemd unit to restart. The agent gets that one object, writes /etc/k0s/containerd.d/kata.toml, and re-executes its own binary as 5spot nsenter -t 1 -m -u -i -n -p -- systemctl restart -- <unit> (ADR 0020): a fresh, single-threaded process that enters host PID 1's namespaces with setns(2) and runs the host's systemctl. The image has no nsenter, shell or systemctl of its own.

Its per-pod ServiceAccount grants nodes: get,patch cluster-wide and configmaps,secrets: get (no list, no watch) in the target namespace.

ID Threat STRIDE Likelihood Impact Status
K1 Drop-in written outside /etc/k0s/ — a host path supplied through the CR or annotation, or a symlink planted on the host, redirects the write anywhere on the node T, E Low Critical Mitigated — no CRD field or annotation carries a host path at all (ADR 0005 removed destPath); the destination is the fixed KATA_CONFIG_DEST_PATH constant, and confine_dest_path canonicalizes and re-checks it against the /etc/k0s/ base before every write and unlink, fail closed (src/kata_config_agent.rs)
K2 Command injection through the restart path T, E Low Critical Mitigated, twice over: nsenter_restart_argv builds an argv vector (since ADR 0020, /proc/self/exe nsenter …), so there is no shell anywhere in the path and metacharacters in any field are inert; and since ADR 0012 the argv carries a second --, between restart and the unit, which ends systemctl's own option parsing. The first -- ends the nsenter subcommand's. Verified on a host: a unit beginning with - reaches systemctl as a unit (src/kata_config_agent.rs, src/cmd/nsenter.rs)
K6 The hidden 5spot nsenter subcommand is present in every component's image, so any 5-Spot pod could try to enter host namespaces E Low Critical Mitigated. Entering another process's namespaces needs CAP_SYS_ADMIN, which the kernel enforces; only the Kata-config agent's ServiceAccount is admitted with privileged: true (deploy/admission/agent-pod-security-policy.yaml, ADR 0004). Without it the subcommand refuses and runs nothing rather than falling back to its own namespaces (src/cmd/nsenter.rs; verified on a host: "Permission denied", no command run). The subcommand adds no capability: the same entry was always possible for a privileged pod with any setns-capable binary
K3 Drop-in content is attacker-chosen: containerd configuration is executed-adjacent, and the agent restarts the runtime that reads it T, E Low Critical Accepted — architecturally required. This is the agent's entire purpose. The control is upstream: whoever may set spec.kata on a ScheduledMachine, or write the Node annotation, is choosing containerd configuration on that node. Treat create/update on scheduledmachines carrying spec.kata, and patch nodes in the workload cluster, as node-root-equivalent grants (§7 deployment controls, §8)
K4 Restart of an unintended host unit T, D Low High Mitigated for the injection case (ADR 0012) — the argv's option terminator means a value beginning with - is a unit name and not a flag such as -H (remote host over SSH), -M (container) or --root=. The CRD pattern is anchored so a leading hyphen is not admissible (src/crd.rs), and parse_kata_ref re-checks the same rule on the agent's own input. Not mitigated for the policy case: a syntactically valid unit the operator did not intend — sshd.service matches and always will — which is why §7 treats spec.kata as a node-root-equivalent grant
K5 The agent trusts its Node annotation, which RBAC cannot scope to the agent's own Node S, T, E Low High Mitigated for the agent case (ADR 0012 + ADR 0013). ADR 0012 made the agent distrust the annotation's shape — parse_kata_ref validates every field and refuses a bad one, so no write and no restart. ADR 0013 addresses its authority: deploy/admission/kata-config-annotation-policy.yaml rejects any Node UPDATE that changes 5spot.finos.org/kata-config-ref when the requester is a node-agent ServiceAccount, comparing object against oldObject so their own kata-config-applied writes still pass. A compromised agent can no longer retarget another node. Residual: anything else holding cluster-wide nodes: patch — a human admin, a CI identity — still can; see §8
K6 Stolen agent token enumerates or reads the workload cluster I Low Medium Mitigated — get only on configmaps/secrets, no list/watch: a stolen token reaches objects the attacker can already name, not the namespace (deploy/kata-config-agent/rbac.yaml)
K7 The agent's privileged posture is inherited by an unrelated pod in 5spot-system E Medium Critical Mitigated (ADR 0004) — 5spot-agent-pod-security VAP pins privileged to the kata agent's ServiceAccount alone, clamps hostPath per agent, denies hostNetwork/hostIPC, failurePolicy: Fail (deploy/admission/agent-pod-security-policy.yaml)
K8 Restart loop — every reconcile bounces the host service D Low High Mitigated — the applied-content hash is recorded in the kata-config-applied Node annotation and needs_restart fires only on an actual content transition (src/kata_config_agent.rs)

6.6 Capacity Controller (Trust Boundary: TB7)

The 5spot-capacity-controller Deployment reconciles ScheduledCapacity. It creates and owns an object in an allowlisted API group, under the ScheduledCapacity's own name and namespace, and scales one numeric field on it so a spot schedule can gate a bounded slice of a host that stays in the cluster (ADR 0011, actuation per ADR 0016). It sets a controller ownerReference back to the ScheduledCapacity, and never deletes anything.

Its own ServiceAccount grants create and patch on the allowlisted target group and patch on its own CRD's /status, read-only on the spot-schedule group and on scheduledmachines, plus create on selfsubjectaccessreviews. It holds no Secret access, no CAPI verbs, and no delete anywhere.

The attacker set changed with ADR 0016, in both directions. ADR 0011's most interesting attacker was the ScheduledCapacity author, who supplied a field path that the controller wrote with its own broader credential: a confused-deputy shape, and the reason C1 and C2 existed. That shape is gone, because there is no longer an object someone else owns to aim at. What takes its place is narrower but real: an author who supplies the whole spec of an object 5-Spot's credential then instantiates (C10), and anyone who can pre-create an object under the name 5-Spot will derive (C11).

C1 and C2 are retained as superseded rows rather than deleted. A threat that was mitigated and then designed away is more useful to a future reader than a gap in the numbering, and keeping them makes it checkable that the surface was removed rather than quietly dropped.

ID Threat STRIDE Likelihood Impact Status
C1 spec.capacity.path names metadata.ownerReferences, finalizers or labels, so a CR author uses the controller's credential to take ownership of, block deletion of, or re-label an object in the target group T, E n/a n/a Superseded by ADR 0016: the surface no longer exists. spec.capacity.field is a path relative to the spec of an object 5-Spot built, so metadata. is not rejected, it is unreachable: there is no metadata in scope for the path to name. spec, metadata and status in first position are still refused (capacity_path.rs::validate_capacity_field), but as mistakes rather than threats, because spec.warmReplicas here would construct spec.spec.warmReplicas. Historical mitigation, for the record: the path must match CAPACITY_PATH_PATTERN (dot-separated camelCase, so no indices, wildcards, .., quotes or /) and a CEL rule pins it to the spec. prefix, so metadata. and status. are inadmissible (src/crd.rs). The reconciler re-validates before any API call (src/reconcilers/capacity_path.rs), which is the check that still holds when the deployed CRD is older than the binary, precisely the case a schema cannot defend. Verified against a live API server: metadata.ownerReferences, metadata.finalizers, metadata.labels and status.claimed are all rejected at admission
C2 The path is read as a JSON Pointer or JSONPath expression, so ~0, /, [0] or a quoted segment escapes the intended field T, E Low Low Mitigated, and its impact downgraded by ADR 0016. The charset remains an allowlist ([a-z][a-zA-Z0-9]* per segment), not a denylist of characters someone thought of, so nothing outside camelCase is expressible however the value is later interpreted, and injection walks the validated segments rather than parsing a path expression (capacity_path.rs::inject_capacity_field). Impact falls from High to Low because an escape would now reach another field of an object 5-Spot owns and is about to overwrite anyway, not a field of a stranger's
C3 The controller creates an object in an API group it was never meant to write T, E Low High Mitigated: ALLOWED_CAPACITY_TARGET_API_GROUPS (src/constants.rs) is the third allowlist beside the bootstrap and infrastructure ones, checked in the reconciler so the permitted set lives in one greppable place and cannot be widened by a stale CRD. The ClusterRole grants create and patch on exactly those groups, so RBAC is the second gate. The check now gates a create rather than a patch, which raises what it is protecting and is why the kind e2e installs its stub consumer CRD under the real group rather than widening the allowlist for the test
C4 A capacity change destroys in-flight work: the capacity object is zeroed, or removed, while claims are live T, D Medium High Mitigated by construction, in two parts. On a schedule: actuation is a field write, never a delete, and the inactive value is a warm-pool zero: it stops replenishment while claimed work finishes on its own. The consumer owns claim binding and drain, which 5-Spot has no way to reason about. On deactivation the controller writes zero and then waits for spec.handback.drainedPath to reach zero, up to handback.timeout; on expiry it holds and reports loudly rather than escalating (ADR 0011 decision 6), because a missed handover is visible and recoverable while killed work is not. On deletion of the ScheduledCapacity: garbage collection removes the owned object, which cascades to whatever it owns. That is safe only because the consumer re-parents in-use resources away from the capacity object when they are claimed, so the cascade takes the idle capacity and leaves the work. Verified in the reference consumer's code, where a bound member's ownerReferences move from the pool to the claim at bind time by recorded decision. It is not a property 5-Spot can enforce, so it is §9 assumption 9 and a LOW residual in §8, not a control
C5 A host is governed by both a ScheduledMachine and a ScheduledCapacity, so it is drained for handover while capacity is still being sized on it T, D Medium Medium Mitigated (ADR 0014). spec.nodeName is compared against every ScheduledMachine.status.nodeRef.name in the namespace, and a match sets HostGovernanceConflict=True and drives capacity to zero (src/reconcilers/capacity_decision.rs). The active value is never written to a conflicted object whatever the schedule says, so the fail-closed intent holds where it matters, while zero removes a contradiction that may already exist rather than freezing it. ADR 0011 originally said "refuse to write", which left a value written before the conflict standing: the exact state the invariant forbids, observed live. The check is controller-side, not admission, because a ValidatingAdmissionPolicy evaluates one request against its own object and its paramRef and cannot look up other objects at all. Residual, now LOW: a spec.nodeName colliding with an unrelated machine zeroes capacity the operator wanted, until the reference is corrected; spec.nodeName is optional for exactly that reason. §8
C6 The capacity grant compounds the machine controller's CAPI and bootstrap/infrastructure wildcards E Low High Mitigated: this is the reason for the separate process and identity (not a separate binary; the capacity controller is a subcommand of the one binary since ADR 0020), and the reason ADR 0016's widened grant does not make the two HIGH residuals in §8 grow. A distinct ServiceAccount, Deployment and ClusterRole; the machine controller's ClusterRole is not extended (ADR 0011 decision 3). Verified against a live API server with 26 SubjectAccessReview assertions, and re-asserted in the kind e2e in both directions: the capacity identity cannot delete or create a CAPI Machine, read a Secret, delete the object it owns, patch a ScheduledMachine or evict a Pod, and the machine controller cannot create, patch or delete the capacity target group
C7 An RBAC gap surfaces as a partial write or an opaque 403 mid-actuation D Low Low Mitigated: a pre-flight SelfSubjectAccessReview for both create and patch on the resolved target runs before the first write, so a missing grant becomes a TargetResolved=False condition naming the resource and the verb (ADR 0011 decision 5, ADR 0016 decision 7). Both verbs are checked because server-side apply needs create while the object is absent and patch once it exists: checking one would let the controller work until the first window and then stop
C8 The controller re-patches its own status every reconcile, re-triggering its own watch and flooding the API server D Low Medium Mitigated: condition lastTransitionTime is preserved unless the condition's status changes, and the computed status is compared against the stored one so a no-op patch is never sent. Found by running against a real API server, which measured ~50 resourceVersion bumps/second before the fix; pinned by a test that derives the expected status key set from the type rather than a hand-written list
C9 A missing or unparseable drain counter is read as "drained", completing a handback that never happened T, D Low Medium Mitigated: Some(0) and None are deliberately different answers: an unread or non-numeric counter keeps the object in HandingBack and says so in the status message, rather than being collapsed to zero (capacity_path.rs::read_i64_at)
C10 New with ADR 0016. spec.template is an opaque pass-through forwarded as the owned object's whole spec, so a ScheduledCapacity author has 5-Spot's credential instantiate a spec they wrote: an oversized pool, a privileged guest template, an image from a registry they choose T, E Medium High Partially mitigated; a recorded residual. Bounded three ways: the API-group allowlist (C3) fixes which kinds can be created at all; the separate identity (C6) means the created object cannot be a CAPI Machine or anything with cluster-level reach; and the consumer's own admission policies validate whatever the owned object goes on to create, which is where a guest's privilege is actually decided. 5-Spot itself does not inspect the template, by design: typing it would silently prune fields the consumer's CRD grew since 5-Spot last shipped. This is the same residual as bootstrapSpec.spec (§8), now in a second instance, and §9 assumption 8 applies unchanged: create on scheduledcapacities must be restricted like create on scheduledmachines
C11 New with ADR 0016. An object already exists under the name a ScheduledCapacity derives, owned by the consumer or by another party, and 5-Spot adopts and overwrites it. Conversely, pre-creating such an object blocks the capacity from ever being declared T, D, E Medium High Mitigated: before any write the reconciler requires the existing object to carry a controller ownerReference whose uid is this ScheduledCapacity's, and otherwise refuses with TargetResolved=False / TargetNotOwned (scheduled_capacity.rs::is_owned_by). Matching on uid rather than name or kind is what makes it sound: a name and kind can be written by anyone who can write the object's metadata, while a uid identifies one instance the API server issued, and garbage collection keys off the same field so the check and the cascade agree by construction. A non-controller reference does not count. This check is the write-side half of the "only objects you created" constraint RBAC cannot express, and it is the precondition that makes the force-apply safe. The denial-of-service direction (pre-create to block) is the only outcome left available, and it is visible on the condition rather than silent
C12 New with ADR 0016. Server-side apply with force silently takes ownership of fields another manager owns T Low Medium Mitigated by the pairing with C11, not by force being safe in itself. force is used, which on a contested object would steal field ownership from whoever held it. It is sound here only because C11 has already established that the object carries 5-Spot's own controller ownerReference, so there is no legitimate other manager of its spec; the consumer's reconciler writes only status, verified in its code. If C11 were ever weakened, force would become a takeover primitive, so the two must be read as one control (scheduled_capacity.rs::apply_owned_object)

7. Mitigations Summary

Implemented (as of 2026-09-23)

Control Where Addresses
EmbeddedResource.namespace field removed src/crd.rs T1 — cross-namespace creation
validate_api_group() allowlist src/reconcilers/helpers.rs T4, E1 — kind/apiVersion injection
validate_labels() reserved prefix rejection src/reconcilers/helpers.rs T2, T3 — label/annotation injection
One constant for the controller-owned scheduled-machine label, stamped and watched src/constants.rs, src/labels.rs T2, T12: keeps the owned key inside RESERVED_LABEL_PREFIXES; a second literal is how the key fell outside it
Machine bootstrap/infrastructure references serialized for the discovered CAPI contract src/reconcilers/helpers.rs (machine_contract_ref) ADR 0017: removes a silent-divergence class; the API server strictly rejects a mis-shaped reference, so a wrong shape fails closed rather than creating a partly-linked Machine
checked_mul + MAX_DURATION_SECS cap src/reconcilers/helpers.rs T7 — duration overflow
Timezone maxLength + character pattern in CRD src/crd.rs T6 — log injection
tokio::time::timeout(600s) in finalizer cleanup src/reconcilers/helpers.rs D2 — finalizer hang
Host-namespace entry fails closed and needs no tool in the image: the Kata agent re-executes itself as 5spot nsenter, which opens and enters every namespace before running anything and refuses otherwise src/cmd/nsenter.rs, src/cmd/kata_config_agent.rs (ADR 0020) K2, K6: restart run in the wrong namespaces, or a namespace-entering tool in every image
Server-side watch timeout below the client read timeout, on every watch, with a compile-time guard src/stream.rs (watch_config), src/constants.rs D6: watch events delayed by client-side read timeouts (bug-008)
A real-Cluster-API end-to-end tier and strict example validation, run on every relevant change .github/workflows/e2e.yaml, .github/scripts/k0smotron-e2e.bats, .github/scripts/validate-examples.py (ADR 0019) Regression of the CAPI contract (ADR 0017), of the owned label the watches select on (T12, bug-007), and of watch timeliness (D6); provider fields silently dropped from an embedded bootstrapSpec / infrastructureSpec because the provider renamed them
k0smotron.io RBAC narrowed to explicit resources deploy/deployment/rbac/clusterrole.yaml E2 — over-privileged SA
Non-root container, read-only root filesystem, all caps dropped deploy/deployment/deployment.yaml E3 — token theft
CPU/memory resource limits deploy/deployment/deployment.yaml D1 — resource exhaustion
PDB 429 handling in evict_pod src/reconcilers/helpers.rs D5 — API rate limit crash
Cosign image signing in release CI .github/workflows/release.yaml S3 — image tampering
Host-identity verification (machine-id cross-check) src/reclaim_agent.rs::compare_machine_ids + deploy/node-agent/daemonset.yaml (/etc/machine-id mount) S5 — DaemonSet-tampering NODE_NAME spoof
Distinct field managers (5spot-reclaim-agent vs 5spot-controller-reclaim-agent) All Node PATCH paths R1 — audit attribution
Per-pod ServiceAccount with nodes: get,patch only (no list/watch) deploy/node-agent/rbac.yaml T12 — agent enumerates other Nodes
Opt-in 5spot.finos.org/reclaim-agent: enabled nodeSelector deploy/node-agent/daemonset.yaml Bounds where the hostPID agent runs to Nodes with killIfCommands set (T13 itself closed by ADR 0021)
Loop-protection (RapidReReclaim warning + counter) src/loop_protection.rs + src/reconcilers/helpers.rs::handle_emergency_remove D8 — re-enable loop
Agent pod-security exception boundary (5spot-agent-pod-security VAP, deny-by-default in 5spot-system) deploy/admission/agent-pod-security-policy.yaml + binding (ADR 0004) E5 — abuse of the namespace-wide PSA/OPA/Kyverno exemption the privileged agents require
The agent policy proved both ways against a real API server: the shipped DaemonSets rendered into Pods must be admitted, and a capability add, a host-root mount and NET_ADMIN must be denied .github/scripts/agent-pod-security.bats, run by make kind-verify-admission in .github/workflows/admission-test.yaml E5, K7, T13: a policy that drifts from the manifests it governs, in either direction
Capacity field rooted at the owned object's spec, constrained to camelCase segments with reserved roots refused (CRD pattern and a CEL rule, re-checked in the reconciler) src/crd.rs, src/reconcilers/capacity_path.rs C2: pointer-escape. C1 no longer applies: metadata. is unreachable rather than rejected (ADR 0016)
Capacity target API group allowlist, checked in the reconciler and mirrored in RBAC; now gates a create src/constants.rs (ALLOWED_CAPACITY_TARGET_API_GROUPS), deploy/capacity-controller/clusterrole.yaml C3, C10: creating an object in an unintended API group
Separate capacity identity: own process (the capacity-controller subcommand in its own Deployment), ServiceAccount and ClusterRole; create + patch on one group, no delete anywhere, no secrets, no CAPI deploy/capacity-controller/ (ADR 0011, ADR 0016) C6, C10: compounding the machine controller's CAPI and bootstrap wildcards
Pre-flight SelfSubjectAccessReview for both create and patch before the first capacity write src/reconcilers/scheduled_capacity.rs C7: opaque 403, partial write, or working until the first window and then stopping
Cooperative bounded handback: write zero, wait on drainedPath, hold and report on timeout; never delete on a schedule src/reconcilers/capacity_decision.rs (ADR 0011 decision 6) C4: destroying in-flight work
uid-matched controller-ownership check before any write to the capacity object src/reconcilers/scheduled_capacity.rs (is_owned_by) C11, C12: adopting a same-named object someone else owns; making a force apply safe
Removal by owner-reference garbage collection, with no delete verb granted deploy/capacity-controller/clusterrole.yaml, src/reconcilers/scheduled_capacity.rs (build_owned_object) C11: a delete grant on the group could not be scoped to objects 5-Spot created
No-op status patch guard and preserved condition timestamps src/reconcilers/scheduled_capacity.rs C8: self-triggering reconcile loop against the API server

Supply Chain (TB0 — contributor / CI to published artifact)

§5 lists a supply-chain attacker; these are the controls that answer it. All of them run in .github/workflows/.

Control Where Addresses
SLSA build provenance on every release .github/workflows/build.yaml (provenance: true) Forged or substituted release artifact
Cosign keyless signing, by digest not tag .github/workflows/build.yaml S3 — image tampering after publication
SBOM generated per image and per release .github/workflows/build.yaml (sbom: true, anchore/sbom-action) Unknown component inventory
Auto-VEX presence + reachability gate, byte-exact, fails closed (ADR 0008) src/bin/auto_vex_*.rs, .vex/, release workflow An advisory shipping untriaged
Bounded dependency internalization: <=500 lines, excluded categories, measured on the production target (ADR 0015) .claude/rules/dependency-internalization.md, roadmap 04 §2a T10 in the reducing direction, by shrinking the set of upstreams that can be compromised at all. Its limit is the point: internalized code is not in the SBOM, so the controls above stop covering it, which is why specs, crypto, reference data and proc macros are excluded however thin their surface looks
Base images digest-pinned on the FROM line, Dependabot-tracked (ADR 0010) Dockerfile, Dockerfile.chainguard, .github/dependabot.yml A stale or substituted base image
One image per variant containing only /5spot, for every component: no shell, no nsenter, no extra binary; agent images retired Dockerfile, Dockerfile.chainguard, deploy/ (ADR 0020) Components that could not start from a release (capacity controller, both agents), and per-component image drift. One SBOM, one signature and one scan now cover every component
Actions SHA-pinned; Dependabot groups and a 7-day cooldown per ecosystem .github/workflows/*, .github/dependabot.yml A compromised action release
Scanning: CodeQL, Trivy (image + IaC), grype, cargo audit, cargo deny, gitleaks, Semgrep .github/workflows/ Known-vulnerable dependency, leaked credential
Advisories are fixed, not suppressed: deny.toml keeps ignore = [] deny.toml, .github/workflows/build.yaml (cargo-deny) A known advisory being silenced instead of resolved. ADR 0018 is the worked example: RUSTSEC-2024-0449 was closed by replacing serde_yaml with the safe-Rust serde-saphyr, not by adding an ignore entry
No pull_request_target, no issue_comment; untrusted event fields reach run: only through env: .github/workflows/ Workflow script injection from a fork
The e2e job holds contents: read only, uses no secrets and publishes nothing; its tools are pinned by SHA-256 (kind, clusterctl) and its images by digest (kindest/node, the bootloose worker) .github/workflows/e2e.yaml, Makefile (e2e-tools), .github/scripts/e2e-k0smotron.sh (ADR 0019) A compromised test input reaching a credential or an artifact. At worst it can falsify a test result; see §8 for the inputs pinned by version only

Deployment-Layer Controls (operator responsibility)

Control Recommendation
Kubernetes ResourceQuota Limit ScheduledMachine count per namespace (e.g., max 50)
ValidatingAdmissionPolicy ✅ deployed 2026-04-08 Validates bootstrapSpec.apiVersion, infrastructureSpec.apiVersion, kind fields, duration format, and day/hour item format at admission time — see deploy/admission/
NetworkPolicy Restrict controller pod egress to the management API server (6443), child/k0smotron-hosted control planes (NodePort apiPort 30443), and DNS — all other egress denied
Audit logging Enable API server audit log at RequestResponse level for scheduledmachines resources
RBAC for SM creation Only grant create on scheduledmachines to trusted identities; do not grant to end users directly
RBAC for spec.kata A ScheduledMachine carrying spec.kata chooses containerd configuration on a node and triggers a host service restart (§6.5). Grant it only to identities you would trust with node root
RBAC for patch nodes (workload cluster) Node-root-equivalent wherever the kata-config agent runs — the agent's input is a Node annotation. See §8
Secrets for bootstrap data Move sensitive bootstrap config out of CR spec into Secrets; reference from spec

8. Residual Risks

HIGH — Sensitive data in bootstrapSpec.spec

Threat: EmbeddedResource.spec is an arbitrary JSON object with x-kubernetes-preserve-unknown-fields: true. It may contain SSH keys, IP addresses, tokens, or other credentials stored in plaintext in etcd and visible to anyone with get scheduledmachines access.

Recommendation: Introduce a secretRef field alongside spec that references a Secret, and merge the Secret's data at runtime inside the controller. This keeps credentials out of the CR and benefits from Kubernetes secret encryption-at-rest.

Workaround (now): Restrict get/list on scheduledmachines to the owning service account and cluster admins only.

Widened in scope 2026-10-09 (no new class). The same opaque passthrough also carries behaviour, not only data. Confining a Worker with cgroups documents the supported pattern of putting K0sWorkerConfig.files and preK0sCommands in bootstrapSpec.spec, which the bootstrap provider executes as root on the worker host: arbitrary host files, arbitrary systemd units, arbitrary commands. That power is k0smotron's and predates the page, but anyone reading the page now knows it is there, so the exposure of bootstrapSpec is write-side as well as read-side and the get/list workaround above does not address it. Whoever may create a ScheduledMachine in a namespace can root every host its RemoteMachine reaches. Revisit when bootstrapSpec gains a secretRef: the same change should decide whether a narrower, declarative confinement field is preferable to passing host-file content through an opaque blob.


HIGH — Bootstrap/Infrastructure RBAC wildcards

Threat: bootstrap.cluster.x-k8s.io and infrastructure.cluster.x-k8s.io still use resources: ["*"] in the ClusterRole because the controller is designed to be provider-agnostic. A compromised controller can create any bootstrap or infrastructure resource cluster-wide.

Recommendation: For deployments targeting a single known provider, replace wildcards with explicit resource lists (e.g., k0sworkerconfigs only). Document this in the operator deployment guide.


MEDIUM — clusterName immutability

Threat: A user can update spec.clusterName on an active ScheduledMachine. The controller will reconcile with the new cluster name, potentially creating CAPI resources in a different cluster while leaving orphaned resources in the original cluster.

Recommendation: Use a CEL validation rule (x-kubernetes-validations) to make clusterName immutable after creation:

x-kubernetes-validations:
  - rule: "self == oldSelf"
    message: "clusterName is immutable"


LOW — Kill switch audit trail

Threat: Activating spec.killSwitch: true removes a machine on the next reconcile, which follows the watch event within seconds. The only record is the Kubernetes API audit log (if enabled). No Kubernetes Event is emitted by the controller.

Correction (1.9): until bug-008 was fixed on 2026-10-13, "within seconds" did not hold. Watches were killed client-side every 30 seconds, so the flip could wait for the next requeue or relist. See D6.

Recommendation: Emit a Kubernetes Event with reason: KillSwitchActivated and type: Warning when the kill switch fires, so it appears in kubectl describe scheduledmachine and feeds into alerting pipelines.


HIGH: An opaque spec.template is instantiated by 5-Spot's credential

New with ADR 0016, and the second instance of the residual already recorded for bootstrapSpec.spec rather than a new class of risk. ScheduledCapacity.spec.template is forwarded verbatim as the owned object's spec, so whatever the consumer's CRD admits, a ScheduledCapacity author can write and 5-Spot's ServiceAccount will create: an oversized pool, a guest template with privileges the author should not have, an image from a registry they chose.

It is not typed on purpose. A typed schema would silently prune fields the consumer's CRD grew since 5-Spot last shipped, turning a correct template into an incorrect object with no error anywhere, which is a worse failure than the one it would prevent.

Bounded by: the API-group allowlist (C3), which fixes which kinds can be created at all; the separate identity (C6), so the created object can never be a CAPI Machine or anything with cluster-level reach; and the consumer's own admission policies, which are where a guest's privilege is actually decided.

Revisit when: a consumer publishes a stable, versioned subset of its pool spec that 5-Spot could reasonably pin, or when an admission policy on scheduledcapacities becomes worth writing against a concrete deployment's template shape.

LOW: Deleting a ScheduledCapacity relies on the consumer re-parenting claimed work

New with ADR 0016. Garbage collection removes the owned capacity object, which cascades to whatever that object owns. Only idle capacity should go with it, and that is true because the consumer moves an in-use resource's ownerReferences from the capacity object to the claim at bind time. Verified in the reference consumer's code, as a recorded decision rather than an accident.

It is not a control 5-Spot holds, and it is not stated as a requirement in the published spot-schedule contract, so a different consumer that keeps owning its in-use resources from the capacity object would lose work when a ScheduledCapacity is deleted. The window is narrow (it needs an operator to delete the ScheduledCapacity, not merely to close the schedule, since window close only writes zero) which is why this is LOW rather than higher.

Revisit when: a second capacity consumer appears, or when the requirement is written into docs/src/reference/ as a published expectation on consumers rather than an observation about one of them.

LOW: A mis-set spec.nodeName zeroes capacity the operator wanted

Closing the former MEDIUM (a conflict leaving written capacity in place) by driving to zero (ADR 0014) trades it for a smaller risk in the other direction: if spec.nodeName names a node an unrelated ScheduledMachine happens to govern, the consumer loses its warm pool until the reference is corrected.

Bounded and self-correcting. The gated field is a warm-pool target rather than a kill, so claimed work finishes; the condition and message name the conflicting ScheduledMachine and the node; and the next reconcile after the reference is fixed restores the active value, with no operator action beyond that. spec.nodeName is optional precisely so an operator who cannot name the node confidently leaves it unset, in which case no conflict is detected and the invariant stays documentation only.

Revisit when: a Kubernetes Event is added for the conflict (ADR 0014 option D, not adopted), which would make this page someone rather than wait to be noticed.

LOW: Internalized code is outside dependency scanning

ADR 0015 internalizes a dependency when its used surface is 500 lines or fewer. Each one removes an upstream that could be compromised, and simultaneously removes a component that cargo audit, cargo deny and the Grype scan report on: a defect in src/stream.rs is found by review, not by a scanner.

Accepted deliberately, and bounded by the policy rather than by a control. The 500-line ceiling is low, every internalization must be testable at least as well as upstream for the surface used, and the categories where a thin surface hides a thick moving specification (wire formats, crypto, reference data, date/time arithmetic, proc macros) are excluded outright. Current exposure is 19 lines.

Revisit when: the internalized total approaches a few hundred lines, or an internalization is proposed that cannot be pinned by tests. Either is a signal the ceiling is doing less work than it appears to.

LOW: Capacity rows written under the old scheme are not reclaimed

Not a 5-Spot control: noted because operators will see it. Where a consumer's status aggregates per-writer rows, rows written before a writer's identity changes are not taken over by the new identity and persist until the consumer prunes them. 5-Spot neither writes nor reads those rows.

Revisit when: a consumer asks 5-Spot to participate in pruning.

LOW: Objects written under ADR 0011's patch-only scheme are left behind

New with ADR 0016, and operational rather than adversarial. A deployment running v0.3.2 patched spec.warmReplicas on a consumer-owned object named by spec.targetRef. After the upgrade that object is no longer referenced by anything: 5-Spot creates its own, and the ownership check (C11) means it will never touch the old one again. The last value 5-Spot wrote therefore stands on it until its owner reconciles it away.

Nothing can be automated here without the delete verb this design deliberately does not hold, and the object was never 5-Spot's to remove. The upgrade note in .claude/CHANGELOG.md says to delete and recreate affected ScheduledCapacity objects, which leaves the consumer's object to its owner.

Revisit when: never, for 5-Spot. It closes when operators have completed the v0.3.2 migration.

MEDIUM — Node-side agents hold cluster-wide nodes: patch

Threat: Both DaemonSet agents act only on their own Node — the reclaim agent writes its three reclaim annotations, the kata-config agent records the applied hash and clears the opt-in label on tear-down — but Kubernetes RBAC cannot express "the Node this pod runs on". Both ServiceAccounts therefore hold nodes: patch across the cluster. list/watch are deliberately withheld (T12, K6), so an agent cannot enumerate the cluster; it can still write to a Node it can name.

This matters more for the kata-config agent than for the reclaim agent, because the 5spot.finos.org/kata-config-ref annotation is not merely data: it is an instruction consumed by a privileged component on the node that reads it (§6.5, K5). The Node annotation — not the CRD — is that agent's real input, and the ScheduledMachine schema does not gate it.

Narrowed twice on 2026-09-27. ADR 0012 made the agent validate every field of the annotation before acting on it, so a malformed or option-shaped value is refused rather than executed. ADR 0013 then took the recommendation below and shipped it: deploy/admission/kata-config-annotation-policy.yaml denies the node agents any change to 5spot.finos.org/kata-config-ref, which closes the node-to-node lateral path this entry was written about.

What is left is narrower and belongs to the operator: the agents' grant is still cluster-wide, and other holders of nodes: patch — a human admin, a CI identity, other tooling — can still write the key. Per-node ServiceAccounts with resourceNames would close that and were rejected as a lifecycle system in exchange for a bound admission gives for nothing (ADR 0013).

The control that shipped, for reference: a ValidatingAdmissionPolicy on nodes UPDATE that permits a change to the 5spot.finos.org/kata-config-* annotation keys only when request.userInfo.username is the controller's ServiceAccount, denying it to every other principal including the agents themselves. This bounds the annotation to its one legitimate writer without needing per-node ServiceAccounts.

Workaround (now): Treat patch nodes in a workload cluster running the kata-config agent as a node-root-equivalent grant, and review every binding that carries it. Audit changes to 5spot.finos.org/kata-config-ref — the controller's field manager is the only expected writer.


LOW: e2e provider manifests are pinned by version, not by digest

Threat: make e2e-k0smotron-up installs cert-manager, Cluster API and k0smotron through clusterctl init at pinned versions (Cluster API v1.14.3, k0smotron v2.2.0). clusterctl fetches those providers' release manifests and images by tag, and the k0smotron worker downloads k0s itself. A re-tagged or substituted upstream release would run inside the e2e job.

Why it is LOW: the job holds a read-only token, no secrets, and publishes nothing, so the worst outcome is a false test result, not a compromised artifact or credential (§7, supply chain). The tools that drive it, kind and clusterctl, are checksum-verified, and the cluster and worker images are pinned by digest.

Revisit when: the e2e job gains any write permission or secret, or its output starts feeding a release decision automatically. At that point pin the provider component manifests by checksum (clusterctl supports a local repository override) and mirror the k0s binary.


LOW: Privileged agent pods carry every component's code

Threat: since ADR 0020 one binary holds every component, so the privileged Kata-config agent pod's image also contains the controller's network-facing code and dependencies, and a vulnerability report against the image no longer says which component is affected.

Why it is LOW: that code runs only if invoked, and invoking it inside the agent pod requires exec into a privileged, hostPID pod, which is already node-root-equivalent. The agent process itself is unchanged and has no listener beyond its metrics port. VEX reachability (ADR 0008) is computed over the one binary, which is conservative rather than permissive.

Revisit when: an agent gains a network listener beyond metrics, or a vulnerability needs per-component triage that the union report cannot give. The answer then is a build-time feature split, not a return to separate images.


LOW — Multi-instance hash distribution weakness

Threat: The consistent hash function adds priority * 1000 to a 64-bit hash, which provides negligible differentiation. High-priority resources may cluster on one instance.

Recommendation: Use a proper consistent hash ring (e.g., rendezvous hashing) when HA multi-instance support is hardened.


9. Security Assumptions

The following conditions are assumed to be true for this threat model to hold:

  1. Kubernetes API server is trusted — requests to the API server are authenticated and authorized; no API server vulnerabilities are in scope.
  2. etcd encryption at rest is enabled — CR specs (which may contain infrastructure details) are encrypted in etcd.
  3. RBAC for ScheduledMachine creation is restricted — only trusted users/service accounts have create permission on scheduledmachines.
  4. Container image integrity: the 5-Spot image, which since ADR 0020 runs every component, is pulled from a trusted registry; image signing is enforced.
  5. Cluster network is trusted — the metrics and health endpoints are not accessible from outside the cluster.
  6. Node-level isolation — physical machines managed by 5-Spot do not share sensitive workloads with other tenants.
  7. The capacity consumer enforces its own drain semantics: 5-Spot writes a capacity field and waits; it has no way to evict, reclaim or account for work already running inside the slice. A consumer that reports drained while work continues, or that never reports at all, is outside 5-Spot's control (C4, C9). This is the deliberate division of labour in ADR 0011: the consumer owns claim binding and drain, 5-Spot owns only the calendar.
  8. create on scheduledcapacities is restricted: a ScheduledCapacity supplies the whole spec of an object the controller then creates with its own credential (spec.template, C10). The target group is allowlisted (C3) and the kind is fixed per object, but whoever may create one still chooses what gets created and how large it is. ADR 0016 changed the reason this assumption is needed, not whether it is: the confused-deputy path is gone, and an author-supplied spec instantiated by a privileged credential has taken its place. Treat it with the same care as create on scheduledmachines, which carries the identical bootstrapSpec.spec shape.
  9. The capacity consumer re-parents in-use resources away from the capacity object. Deleting a ScheduledCapacity garbage-collects the object 5-Spot owns, and the cascade reaches whatever that object owns. The reference consumer moves a claimed member's ownerReferences to its claim at bind time, so only idle capacity goes with the cascade. A consumer that does not do this loses in-flight work on a ScheduledCapacity deletion. 5-Spot cannot verify or enforce this, and the published contract does not yet require it (§8).
  10. No other writer owns the capacity object's spec. 5-Spot applies the complete spec it owns with force, which is sound only while the object is genuinely its own: the uid-matched ownership check (C11) establishes that, and the reference consumer's reconciler writes only status. A consumer that began writing the pool's spec would be in a field-manager fight that force would win silently and wrongly.