feat: introduce rootfs builder module for container images#23
Merged
PrasanthYT merged 1 commit intomainfrom Mar 4, 2026
Merged
feat: introduce rootfs builder module for container images#23PrasanthYT merged 1 commit intomainfrom
PrasanthYT merged 1 commit intomainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This change introduces a container filesystem reconstruction pipeline for the container engine.
The builder reconstructs the merged root filesystem from container image layers, enabling accurate analysis of files and packages inside container images.
RootFS Builder
A new module constructs the final container filesystem by applying layers in order.
Result structure:
The returned path points to the fully reconstructed filesystem.
Layer Processing
The builder performs the following steps:
manifest.json.Whiteout Handling
OCI whiteout files are respected during layer merging.
Supported behaviors:
.wh.<file>→ deletes file.wh..wh..opq→ clears directory contentsThis ensures the reconstructed filesystem matches container runtime behavior.
Extraction Safeguards
To prevent malicious archives or resource exhaustion, several protections were added:
Timeout Protection
A timeout guard prevents extremely slow or malicious extractions from blocking the scan process.
Temporary Workspace Cleanup
RootFS extraction occurs inside a temporary workspace.
All temporary directories are cleaned up automatically on success or failure.
Impact
Result
Container images can now be reconstructed into a merged root filesystem: