pub enum ShellEnvMode {
Filtered,
Strict,
Custom,
Inherit,
}Expand description
How much of the daemon’s environment a shell tool inherits.
A fourth question again, and a fourth shape. A shell tool is a child we hand
over to, like an MCP server - but unlike one, it must keep behaving like the
user’s own shell, so child_env_allowed’s 28-name allowlist is wrong here:
it would strip CARGO_HOME, JAVA_HOME, NVM_DIR, VIRTUAL_ENV, GOPATH
and break every real toolchain. The name-shape denylist is the right
instrument, and the only real question is how far it reaches.
Be honest about what this buys. With cat and grep on the default safe
list, a granted shell can read ~/.leviath/config.toml and find the provider
key anyway. This is defence in depth against accidental leakage - an env
dump in tool output, a printenv in a log, a subprocess that phones home -
and it closes the seed-command case, where nothing was ever approved. It is
not a boundary.
Variants§
Filtered
Withhold credential-shaped names, but hand over SSH_AUTH_SOCK.
The carve-out is deliberate and is why this can be the default: the
agent socket is on the credential-name list, and withholding it breaks
git push over agent keys, which is one of the most ordinary things an
agent does in a shell.
Strict
The full name-shape denylist, SSH_AUTH_SOCK included - and with it
AWS_PROFILE, AWS_REGION, KUBECONFIG, NETRC. Breaks git push,
aws and kubectl in a shell tool until those names are listed in
[security] allow_env_vars.
Custom
Ignore the shape heuristic entirely: withhold exactly what
[security] shell_env_withhold names, and nothing else. For an
environment whose variable names the heuristic reads wrong in either
direction.
Inherit
Hand the whole environment over, as before this setting existed.
Trait Implementations§
Source§impl Clone for ShellEnvMode
impl Clone for ShellEnvMode
Source§fn clone(&self) -> ShellEnvMode
fn clone(&self) -> ShellEnvMode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ShellEnvMode
Source§impl Debug for ShellEnvMode
impl Debug for ShellEnvMode
Source§impl Default for ShellEnvMode
impl Default for ShellEnvMode
Source§fn default() -> ShellEnvMode
fn default() -> ShellEnvMode
Source§impl<'de> Deserialize<'de> for ShellEnvMode
impl<'de> Deserialize<'de> for ShellEnvMode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for ShellEnvMode
Source§impl PartialEq for ShellEnvMode
impl PartialEq for ShellEnvMode
Source§impl Serialize for ShellEnvMode
impl Serialize for ShellEnvMode
impl StructuralPartialEq for ShellEnvMode
Auto Trait Implementations§
impl Freeze for ShellEnvMode
impl RefUnwindSafe for ShellEnvMode
impl Send for ShellEnvMode
impl Sync for ShellEnvMode
impl Unpin for ShellEnvMode
impl UnsafeUnpin for ShellEnvMode
impl UnwindSafe for ShellEnvMode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.