Ensure root filesystem is always read-only inside sandbox
Whitelist mode's implicit bwrap root was a writable tmpfs, letting the sandboxed process create files and directories anywhere not covered by an explicit ro mount. This was not an issue in blacklist mode due to --ro-bind / / covering that case. This patch adds --remount-ro / before any other mount to make the base layer read-only in both modes.
This commit is contained in:
@@ -34,6 +34,7 @@ pub fn build_command(config: &SandboxConfig) -> Result<Command, SandboxError> {
|
||||
add_ro_bind(&mut cmd, path)?;
|
||||
}
|
||||
|
||||
cmd.args(["--remount-ro", "/"]);
|
||||
cmd.arg("--new-session");
|
||||
cmd.arg("--die-with-parent");
|
||||
cmd.arg("--chdir").arg(&config.chdir);
|
||||
|
||||
Reference in New Issue
Block a user