Replace setenv with env list supporting host passthrough

This commit is contained in:
2026-04-22 20:47:01 +02:00
parent 76c5be0e72
commit 494da52fc6
7 changed files with 266 additions and 62 deletions
+16 -1
View File
@@ -20,6 +20,21 @@ pub enum SandboxMode {
Whitelist,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum EnvEntry {
Keep(String),
Set(String, String),
}
impl EnvEntry {
pub fn key(&self) -> &str {
match self {
Self::Keep(k) => k,
Self::Set(k, _) => k,
}
}
}
pub struct SandboxConfig {
pub mode: SandboxMode,
pub hardened: bool,
@@ -29,7 +44,7 @@ pub struct SandboxConfig {
pub extra_rw: Vec<PathBuf>,
pub extra_ro: Vec<PathBuf>,
pub mask: Vec<PathBuf>,
pub setenv: Vec<(String, String)>,
pub env: Vec<EnvEntry>,
pub unsetenv: Vec<String>,
pub bwrap_args: Vec<String>,
pub command: PathBuf,