Skip to content

fix(unikontainers): reject OCI specs with missing root section - #903

Open
Utkarsh-sharma47 wants to merge 1 commit into
urunc-dev:mainfrom
Utkarsh-sharma47:fix-oci-missing-root-validation
Open

fix(unikontainers): reject OCI specs with missing root section#903
Utkarsh-sharma47 wants to merge 1 commit into
urunc-dev:mainfrom
Utkarsh-sharma47:fix-oci-missing-root-validation

Conversation

@Utkarsh-sharma47

Copy link
Copy Markdown

Summary

New() and Get() validate that the OCI spec contains a linux section, but did not validate that root is present.

As a result, a structurally incomplete config such as {"linux":{}} could reach code that dereferences spec.Root.Path, causing a nil pointer panic. With valid unikernel annotations, New() could also return an object with Spec.Root == nil.

This PR:

  • validates that both linux and root are present before further processing
  • preserves the existing missing-linux validation behavior
  • adds regression coverage for New() and Get()
  • verifies that valid unikernel annotations cannot bypass the missing-root check

Fixes #902

Testing

go test ./pkg/unikontainers/... -count=1

@netlify

netlify Bot commented Aug 4, 2026

Copy link
Copy Markdown

Deploy Preview for urunc canceled.

Name Link
🔨 Latest commit 3ad2db2
🔍 Latest deploy log https://app.netlify.com/projects/urunc/deploys/6a7277ad8dcc650009e08a36

@Utkarsh-sharma47

Copy link
Copy Markdown
Author

Hi @cmainas, whenever you have time, could you please take a look at #903? It addresses #902 by validating the missing OCI root section and includes regression tests. If you'd like the approach changed, I'm happy to update the PR. Thanks!

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.

New() can panic on OCI specs with a missing root section

1 participant