feat: masked and read-only container paths (OCI-style hardening)#158
Merged
Conversation
azenla
previously approved these changes
Jul 7, 2026
Add `masked_paths` and `readonly_paths` to CreateRequest and apply them in pivot_fs after all mounts are in place -- so freshly-mounted targets like /proc are covered -- but before pivot, while /dev/null is still reachable for masking. A masked file is covered by a bind of /dev/null (reads return EOF, writes are discarded); a masked directory by an empty read-only tmpfs. A read-only path is bind-mounted onto itself and recursively remounted read-only, leaving its contents readable. Targets that do not exist are skipped, so callers can pass a superset that not every rootfs/kernel populates. Builder gains push_masked_path / push_readonly_path. This is the mechanism only; callers supply the path lists. The two new CreateRequest fields push it past clippy's large_enum_variant threshold, so box both Config variants (Create and Attach) -- boxing only the larger one would just relocate the lint to the other. Box<T> serializes transparently, so the internally-tagged wire form is unchanged. Signed-off-by: Steven Noonan <steven@edera.dev>
tycho
force-pushed
the
steven/masked-paths
branch
from
July 7, 2026 04:31
c5c6371 to
7dfa5d7
Compare
azenla
approved these changes
Jul 7, 2026
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.
Add
masked_pathsandreadonly_pathsto CreateRequest and apply them in pivot_fs after all mounts are in place -- so freshly-mounted targets like /proc are covered -- but before pivot, while /dev/null is still reachable for masking.A masked file is covered by a bind of /dev/null (reads return EOF, writes are discarded); a masked directory by an empty read-only tmpfs. A read-only path is bind-mounted onto itself and recursively remounted read-only, leaving its contents readable. Targets that do not exist are skipped, so callers can pass a superset that not every rootfs/kernel populates. Builder gains push_masked_path / push_readonly_path.
This is the mechanism only; callers supply the path lists.