@@ -83,6 +83,11 @@ provides functions for
8383 - hooking the plugin into pod/container lifecycle events
8484 - shutting down the plugin
8585
86+ An additional interface is provided for validating the changes active plugins
87+ have requested to containers. This interface allows one to set up and enforce
88+ cluster- or node-wide boundary conditions for changes NRI plugins are allowed
89+ to make.
90+
8691### Plugin Registration
8792
8893Before a plugin can start receiving and processing container events, it needs
@@ -277,6 +282,80 @@ can be updated this way:
277282 - Block I/O class
278283 - RDT class
279284
285+ ### Container Adjustment Validation
286+
287+ NRI plugins operate as trusted extensions of the container runtime, granting
288+ them significant privileges to alter container specs. While this extensibility
289+ is powerful with valid use cases, some of the capabilities granted to plugins
290+ allow modifying security-sensitive settings of containers. As such they also
291+ come with the risk that a plugin could inadvertently or maliciously weaken a
292+ container's isolation or security posture, potentially overriding policies set
293+ by cluster orchestrators such as K8s.
294+
295+ NRI offers cluster administrators a mechanism to exercise fine-grained control
296+ over what changes plugins are allowed to make to containers, allowing cluster
297+ administrators to lock down selected features in NRI or allowing them to only
298+ be used a subset of plugins. Changes in NRI are made in two phases: “Mutating”
299+ plugins propose changes, and “Validating” plugins approve or deny them.
300+
301+ Validating plugins are invoked during container creation after all the changes
302+ requested to containers have been collected. Validating plugins receive the
303+ changes with extra information about which of the plugins requested what
304+ changes. They can then choose to reject the changes if they violate some of the
305+ conditions being validated.
306+
307+ Validation has transactional semantics. If any validating plugin rejects an
308+ adjustment, creation of the adjusted container will fail and none of the other
309+ related changes will be made.
310+
311+ #### Validation Use Cases
312+
313+ Some key validation uses cases include
314+
315+ 1 . Functional Validators: These plugins care about the final state and
316+ consistency. They check if the combined effect of all mutations result
317+ in a valid configuration (e.g. are the resource limits sane).
318+
319+ 2 . Security Validators: These plugins are interested in which plugin is
320+ attempting to modify sensitive fields. They use the extra data passed to
321+ plugins in addition to adjustments to check if a potentially untrusted
322+ plugin tried to modify a restricted field, regardless of the value.
323+ Rejection might occur simply because a non-approved plugin touched a
324+ specific field. Plugins like this may need to be assured to run, and to
325+ have workloads fail-closed if the validator is not running.
326+
327+ 3 . Mandatory Plugin Validators: These ensure that specific plugins, required
328+ for certain workloads have successfully run. They might use the extra metadata
329+ passed to validator in addition to adjustments to confirm the mandatory
330+ plugin owns certain critical fields and potentially use the list of plugins
331+ that processed the container to ensure all mandatory plugins were consulted.
332+
333+ #### Default Validation
334+
335+ The default built-in validator plugin provides configurable minimal validation.
336+ It is disabled by default. It can be enabled and selectively configured to
337+
338+ 1 . Reject OCI Hook injection: Reject any adjustment which tries to inject
339+ OCI Hooks into a container.
340+
341+ 2 . Verify global mandatory plugins: Verify that all configured mandatory
342+ plugins are present and have processed a container. Otherwise reject the
343+ creation of the container.
344+
345+ 3 . Verify annotated mandatory plugins: Verify that an annotated set of
346+ container-specific mandatory plugins are present and have processed a
347+ container. Otherwise reject the creation of the container.
348+
349+ Containers can be annotated to tolerate missing required plugins. This
350+ allows one to deploy mandatory plugins as containers themselves.
351+
352+ #### Default Validation Scope
353+
354+ Currently only OCI hook injection can be restricted using the default
355+ validator. However, this probably will change in the future. Especially
356+ when NRI is extended with control over new container parameters. If such
357+ parameters will have security implications, corresponding configurable
358+ restriction will be introduced to the default validator.
280359
281360## Runtime Adaptation
282361
0 commit comments