Add --keep-fd to pass chosen inherited descriptors into the sandbox
This commit is contained in:
+3
-1
@@ -19,6 +19,7 @@ pub use signals::exit_with_status;
|
||||
|
||||
use std::ffi::OsString;
|
||||
use std::fs;
|
||||
use std::os::fd::RawFd;
|
||||
use std::path::PathBuf;
|
||||
use std::process::ExitStatus;
|
||||
use std::time::Duration;
|
||||
@@ -67,6 +68,7 @@ pub struct SandboxConfig {
|
||||
pub env: Vec<EnvEntry>,
|
||||
pub unsetenv: Vec<String>,
|
||||
pub bwrap_args: Vec<String>,
|
||||
pub keep_fds: Vec<RawFd>,
|
||||
pub command: PathBuf,
|
||||
pub command_args: Vec<OsString>,
|
||||
pub chdir: PathBuf,
|
||||
@@ -100,7 +102,7 @@ fn resolve_run_user_from_proc() -> Option<String> {
|
||||
}
|
||||
|
||||
pub fn run(config: SandboxConfig) -> Result<ExitStatus, SandboxError> {
|
||||
inherited_fds::keep_out_of_sandbox()?;
|
||||
inherited_fds::keep_out_of_sandbox(&config.keep_fds)?;
|
||||
preflight::check(&config)?;
|
||||
|
||||
let forwarded_signals = ForwardedSignals::detect();
|
||||
|
||||
Reference in New Issue
Block a user