Skip to content

fix(spur-net): apply OCI whiteouts safely - #610

Open
joshkmartinez wants to merge 3 commits into
ROCm:mainfrom
joshkmartinez:fix/oci-whiteouts
Open

fix(spur-net): apply OCI whiteouts safely#610
joshkmartinez wants to merge 3 commits into
ROCm:mainfrom
joshkmartinez:fix/oci-whiteouts

Conversation

@joshkmartinez

@joshkmartinez joshkmartinez commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Closes #344.

Registry pulls only handled regular whiteouts, and Docker/Podman save imports did not handle whiteouts at all. That could leave files from lower layers in the flattened image.

The registry and daemon paths now use the same layer applier. it validates a layer before changing the rootfs, applies deletions before same-layer entries, handles opaque markers and file-type replacements, and rejects paths that escape the rootfs

Testing

  • 25 focused layer tests covering regular and opaque markers, archive ordering, path containment, type changes, corrupt input, and tar metadata
  • full spur-net suite: 79 tests
  • Docker-save import tests: 6 tests using real manifest-ordered tar layers and filesystem extraction
  • full spur-cli suite: 358 unit tests and 1 integration test
  • affected-crate clippy with warnings denied, formatting, SPDX, and diff checks

was not able to fully test b/c I'm on macos, please confirm everything works as expected

@joshkmartinez
joshkmartinez marked this pull request as ready for review August 11, 2026 02:47
Copilot AI lite review requested due to automatic review settings August 11, 2026 02:47

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

Updates Spur’s OCI/Docker layer extraction to correctly and safely apply OCI whiteouts (including opaque markers) across both registry pulls (spur-net) and docker save imports (spur-cli), preventing lower-layer file leakage into flattened images.

Changes:

  • Centralized OCI layer extraction into spur-net::image_layer::extract, adding validation, safe path handling, whiteout support (regular + opaque), and file-type reconciliation.
  • Switched registry extraction (oci.rs) and docker-save import (spur-cli/src/image.rs) to use the shared layer applier with appropriate unpack policies.
  • Added focused unit tests for whiteouts, ordering, path containment, and docker-save manifests; updated spur-cli deps for runtime tempfile usage.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
crates/spur-net/src/oci.rs Replaces bespoke tar extraction with shared image_layer::extract for registry layers.
crates/spur-net/src/image_layer.rs Introduces the shared layer extraction implementation, whiteout handling, safety checks, and extensive tests.
crates/spur-cli/src/image.rs Updates docker save import to stage extraction and apply layers via image_layer::extract; adds tests.
crates/spur-cli/Cargo.toml Promotes tempfile to a runtime dependency to support staging directory creation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread crates/spur-net/src/image_layer.rs
joshkmartinez and others added 2 commits August 10, 2026 19:53
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

fix(spur-net): opaque whiteouts (.wh..wh..opq) skipped during OCI layer extraction

2 participants