Namespace/tenant-scoped mutation policy: gap in ContainerUpdate

Open
#353 15 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 6 days

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
12/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
go, kubernetes
Domain
backend, security

Research direction

Start with plugins/default-validator and the ValidateContainerAdjustment path in the NRI protobuf definitions to see how the global boolean settings are applied. The open questions are design-level: whether scoping belongs in the validator or the runtime, and whether ContainerUpdate needs a new hook or extra fields. Done means maintainers agree on a direction, not that a patch lands.

Written by the indexing model from the issue text.

Description

Problem

ValidateContainerAdjustment only validates the adjust field (changes to the container being created). A plugin's response can also bundle an update for other, already-running containers:

message ContainerUpdate {
  string container_id = 1;
  LinuxContainerUpdate linux = 2;
  bool ignore_failure = 3;
}

This message carries only a container ID and a resource change, nothing that identifies which pod or namespace the target container belongs to. As a result, a validator can observe that a bundled update occurred, but cannot determine whether it should be allowed, there's no namespace to check a policy against.

This isn't limited to updates bundled into a CreateContainer response. Updates can also arrive via UpdateContainer and as unsolicited updates outside any CRI request entirely, and none of these paths go through any validation hook at all today, ValidateContainerAdjustment only fires at container creation time.

Why this matters

A validator can only ever see and act on the moment a container is first created. Anything that happens to a container afterward, a bundled update to another container, a later resource update, or an unsolicited change initiated by a plugin on its own, bypasses validation entirely. For any consumer that needs to enforce a policy consistently across a container's lifetime, not just at the moment it's created, this is a real, structural gap.

Resolving this without a protocol change would require a validator to independently track every container's pod/namespace association itself (e.g. via Synchronize and ongoing lifecycle events), which seems like the wrong layer to solve this at, given NRI already has this information available elsewhere in its data model.

We don't want to propose a fully-baked design before hearing from maintainers who know this codebase's history and direction. Two shapes seem possible:

  • A new validation hook/RPC, e.g. ValidateContainerUpdate, parallel to ValidateContainerAdjustment, covering updates bundled into a create, UpdateContainer, and unsolicited updates, with the target's pod/namespace resolvable via the request.
  • Extending ContainerUpdate itself to carry pod/namespace context, reusing the existing ValidateContainerAdjustment flow for the bundled-update case specifically.
Dominant language
Go
Stars
419
Forks
105
Avg merge
9d 7h
Merged PRs (30d)
14

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from containerd/nri

All issues in containerd/nri

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.