Skip to content

feat: masked and read-only container paths (OCI-style hardening)#158

Merged
tycho merged 1 commit into
mainfrom
steven/masked-paths
Jul 7, 2026
Merged

feat: masked and read-only container paths (OCI-style hardening)#158
tycho merged 1 commit into
mainfrom
steven/masked-paths

Conversation

@tycho

@tycho tycho commented Jul 7, 2026

Copy link
Copy Markdown
Member

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.

azenla
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
tycho merged commit 7dfa5d7 into main Jul 7, 2026
12 checks passed
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.

2 participants