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