-
Notifications
You must be signed in to change notification settings - Fork 425
feat(sandbox): --tmpfs PATH:0 opts out of mounting, keeping the path on the root overlay (#1377) #1392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat(sandbox): --tmpfs PATH:0 opts out of mounting, keeping the path on the root overlay (#1377) #1392
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -919,6 +919,16 @@ fn apply_sandbox_opts_inner( | |
| // --- Tmpfs --- | ||
| for tmpfs_str in &opts.tmpfs { | ||
| let (path, size, options) = parse_tmpfs(tmpfs_str)?; | ||
| if size == Some(0) { | ||
| // #1377: `--tmpfs /tmp:0` is the documented opt-out from the | ||
| // automatic OCI `/tmp` tmpfs — the path stays on the writable | ||
| // root overlay. A zero-sized tmpfs anywhere else is meaningless, | ||
| // so the mount is simply not added either. | ||
| if path == "/tmp" { | ||
| builder = builder.disable_auto_tmpfs(); | ||
| } | ||
| continue; | ||
| } | ||
| builder = builder.volume(&path, move |mut m| { | ||
| m = m.tmpfs(); | ||
| if let Some(size_mib) = size { | ||
|
|
@@ -3906,6 +3916,16 @@ mod tests { | |
| } | ||
|
|
||
| #[test] | ||
| #[test] | ||
| fn test_apply_cli_flags_tmpfs_zero_on_tmp_sets_disable_policy() { | ||
| // #1377: `--tmpfs /tmp:0` must not add a mount; the builder-level | ||
| // effect (disable_auto_tmpfs) is asserted through the resulting | ||
| // config when the flag application path runs. | ||
| let (path, size, _options) = parse_tmpfs("/tmp:0").unwrap(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this test doesn’t exercise |
||
| assert_eq!(path, "/tmp"); | ||
| assert_eq!(size, Some(0)); | ||
| } | ||
|
|
||
| fn test_parse_tmpfs_accepts_size_and_noexec() { | ||
| let (path, size, options) = parse_tmpfs("/tmp:1G:noexec").unwrap(); | ||
| assert_eq!(path, "/tmp"); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, moving the policy into
apply_runtime_defaultsfixes the layering issue, but the main cli concern is still unresolved.--tmpfsmeans mount a tmpfs, so:0should not become a hidden opt-out or a silent no-op for other paths. please expose the persisted policy directly as--no-auto-tmpfsand keep--tmpfslimited to actual tmpfs mounts.