pub struct ShellEnvPolicy {
pub mode: ShellEnvMode,
pub allow_env_vars: Vec<String>,
pub withhold: Vec<String>,
}Expand description
The resolved [security] shell_env decision for one run.
Carried as data rather than consulted from config at each call, so the
executor has no opinion about where the decision came from and the same
struct serves the shell tool, a Rhai shell(), and a command seed.
Fields§
§mode: ShellEnvModeWhich of the four filtering modes is in effect.
allow_env_vars: Vec<String>Names handed over under every mode, from [security] allow_env_vars.
The same list a Rhai env_var read goes through, so there is one answer
to “may agent-supplied code see this variable”.
withhold: Vec<String>Names withheld under custom, where the built-in name-shape heuristic
is off and only the explicit lists govern. Ignored in the other modes.
Implementations§
Source§impl ShellEnvPolicy
impl ShellEnvPolicy
Sourcepub fn apply(&self, cmd: &mut Command) -> Vec<String>
pub fn apply(&self, cmd: &mut Command) -> Vec<String>
Strip the variables this policy withholds from cmd.
Applied to a built Command rather than to an environment map, so one
call covers however the caller decided to run the thing: the host shell,
a namespace sandbox (which isolates mounts and network but still
inherits the environment), and the fallback that runs on the host when
namespaces turn out to be unusable. A container exec inherits nothing,
so this is a no-op there.
Trait Implementations§
Source§impl Clone for ShellEnvPolicy
impl Clone for ShellEnvPolicy
Source§fn clone(&self) -> ShellEnvPolicy
fn clone(&self) -> ShellEnvPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more