Skip to content

Improve snapshot/oci validation#1668

Merged
ludfjig merged 1 commit into
hyperlight-dev:mainfrom
ludfjig:harden-oci-snapshot-loading
Jul 21, 2026
Merged

Improve snapshot/oci validation#1668
ludfjig merged 1 commit into
hyperlight-dev:mainfrom
ludfjig:harden-oci-snapshot-loading

Conversation

@ludfjig

@ludfjig ludfjig commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Just come misc improvements

Copilot AI review requested due to automatic review settings July 20, 2026 20:24
@ludfjig ludfjig added kind/bugfix For PRs that fix bugs ready-for-review PR is ready for (re-)review labels Jul 20, 2026

Copilot AI 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.

Pull request overview

This PR tightens validation when loading OCI snapshot layouts and snapshot config metadata in hyperlight_host, reducing the chance of accepting malformed images or unsafe artifact files.

Changes:

  • Validate OCI index.json and manifest schemaVersion / mediaType more strictly during load, with clearer error text.
  • Harden artifact file handling by rejecting non-regular files (e.g., FIFOs) when opening blobs.
  • Strengthen snapshot config validation (pt_size presence/nonzero, entrypoint bounds within code region, stack alignment) and add/extend regression tests.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/hyperlight_host/src/sandbox/snapshot/file/mod.rs Adds OCI index/manifest schema and media-type validation and improves media-type error formatting.
src/hyperlight_host/src/sandbox/snapshot/file/fsutil.rs Prevents opening non-regular blob paths (and avoids FIFO blocking on Unix) plus adds a FIFO rejection test.
src/hyperlight_host/src/sandbox/snapshot/file/config.rs Makes snapshot layout validation stricter (required pt_size, code-region entrypoint bounds, alignment checks).
src/hyperlight_host/src/sandbox/snapshot/file_tests.rs Adds regression tests covering the new validation behavior and edge cases.
CHANGELOG.md Notes the user-visible behavior change: stricter snapshot/OCI validation and non-regular file rejection.

andreiltd
andreiltd previously approved these changes Jul 21, 2026
Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
@ludfjig
ludfjig merged commit 484fefb into hyperlight-dev:main Jul 21, 2026
44 checks passed
@github-actions github-actions Bot removed the ready-for-review PR is ready for (re-)review label Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bugfix For PRs that fix bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants