pub struct ProcessEnvIsolation { /* private fields */ }Expand description
Domain-agnostic environment-variable isolation policy enforced by
merry-process across both isolated and host process runners.
By default, all inherited variables starting with MERRY_ are stripped from
child processes so Merry-owned configuration, sandbox tokens, and provider
credentials cannot be observed by workspace commands. Callers may register
additional explicit variable names, which are both stripped from inherited
environments and rejected if an environment override attempts to re-inject
them.
Implementations§
Source§impl ProcessEnvIsolation
impl ProcessEnvIsolation
Sourcepub fn extend_removed_vars(
self,
names: impl IntoIterator<Item = OsString>,
) -> Result<Self, ProcessRunnerError>
pub fn extend_removed_vars( self, names: impl IntoIterator<Item = OsString>, ) -> Result<Self, ProcessRunnerError>
Appends explicit environment variable names to strip from child processes and block from environment overrides.
Sourcepub fn is_explicitly_removed(&self, name: &OsStr) -> bool
pub fn is_explicitly_removed(&self, name: &OsStr) -> bool
Returns true when name is explicitly marked as a removed variable.
Sourcepub fn matches_name(&self, name: &OsStr) -> bool
pub fn matches_name(&self, name: &OsStr) -> bool
Returns true when name matches an explicit removed variable or prefix.
Sourcepub fn validate_overrides(
&self,
overrides: &[(OsString, OsString)],
) -> Result<(), ProcessRunnerError>
pub fn validate_overrides( &self, overrides: &[(OsString, OsString)], ) -> Result<(), ProcessRunnerError>
Rejects environment overrides that attempt to re-inject a variable explicitly marked for removal.
Sourcepub fn resolve_removed_names(&self) -> Vec<OsString>
pub fn resolve_removed_names(&self) -> Vec<OsString>
Resolves all concrete environment variable names to remove from the current process environment for one child spawn.
Includes every explicitly registered variable name plus every currently
set parent variable whose name matches removed_prefixes. Only variable
names are returned; values are never copied.
Sourcepub fn resolve_removed_names_from(
&self,
inherited_names: impl IntoIterator<Item = OsString>,
) -> Vec<OsString>
pub fn resolve_removed_names_from( &self, inherited_names: impl IntoIterator<Item = OsString>, ) -> Vec<OsString>
Resolves concrete removed variable names against an explicit list of inherited parent variable names (deterministic for testing).
Sourcepub fn apply_to_tokio_command(&self, command: &mut Command)
pub fn apply_to_tokio_command(&self, command: &mut Command)
Applies this isolation policy to a tokio::process::Command by calling
env_remove for every resolved variable name.
Trait Implementations§
Source§impl Clone for ProcessEnvIsolation
impl Clone for ProcessEnvIsolation
Source§impl Debug for ProcessEnvIsolation
impl Debug for ProcessEnvIsolation
Source§impl Default for ProcessEnvIsolation
impl Default for ProcessEnvIsolation
impl Eq for ProcessEnvIsolation
Source§impl PartialEq for ProcessEnvIsolation
impl PartialEq for ProcessEnvIsolation
impl StructuralPartialEq for ProcessEnvIsolation
Auto Trait Implementations§
impl Forget for ProcessEnvIsolation
impl Freeze for ProcessEnvIsolation
impl Move for ProcessEnvIsolation
impl RefUnwindSafe for ProcessEnvIsolation
impl Send for ProcessEnvIsolationwhere
RawVecInner: Send,
impl Sync for ProcessEnvIsolationwhere
RawVecInner: Sync,
impl Unpin for ProcessEnvIsolation
impl UnsafeUnpin for ProcessEnvIsolation
impl UnwindSafe for ProcessEnvIsolationwhere
RawVecInner: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.