Skip to content

pkg/cdi: validate container edits in Apply - #367

Open
marquiz wants to merge 1 commit into
cncf-tags:mainfrom
marquiz:devel/container-edits-validate
Open

marquiz wants to merge 1 commit into
cncf-tags:mainfrom
marquiz:devel/container-edits-validate

Conversation

@marquiz

@marquiz marquiz commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Validate the container edits at the beginning of Apply so that invalid edits are rejected before the OCI Spec is touched, also when Apply is called directly without validating the edits first.

Also closes some gaps in the validation:

  • reject nil entries in device nodes, net devices, hooks and mounts instead of panicking
  • reject negative device numbers in device nodes, as -1 is interpreted as a wildcard

@marquiz
marquiz requested review from bart0sh, elezar and klihub October 1, 2026 18:23
Validate the container edits at the beginning of Apply so that invalid
edits are rejected before the OCI Spec is touched, also when Apply is
called directly without validating the edits first.

Also closes some gaps in the validation:
- reject nil entries in device nodes, net devices, hooks and mounts
  instead of panicking
- reject negative device numbers in device nodes, as -1 is interpreted
  as a wildcard

Signed-off-by: Markus Lehtonen <markus.lehtonen@intel.com>

@elezar elezar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My one question is whether we want to skip nils instead of treating them as invalid? Not sure how regularly this would come up though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants