pub struct BashPolicy { /* private fields */ }Expand description
Semantic bash policy with safety rails.
Implementations§
Source§impl BashPolicy
impl BashPolicy
Sourcepub fn allow_command(self, command: impl Into<String>) -> Self
pub fn allow_command(self, command: impl Into<String>) -> Self
Allow a specific command by name (normalized).
Sourcepub fn deny_command(self, command: impl Into<String>) -> Self
pub fn deny_command(self, command: impl Into<String>) -> Self
Deny a specific command by name (normalized).
Sourcepub fn deny_pipe_to_shell(self) -> Self
pub fn deny_pipe_to_shell(self) -> Self
Deny pipes to shells (| bash, | sh, | zsh).
Sourcepub fn allow_pipe_to_shell(self) -> Self
pub fn allow_pipe_to_shell(self) -> Self
Allow pipes to shells.
Sourcepub fn deny_command_chains(self) -> Self
pub fn deny_command_chains(self) -> Self
Deny command chains (;, &&, ||).
Sourcepub fn allow_chains(self) -> Self
pub fn allow_chains(self) -> Self
Allow command chains (;, &&, ||).
Sourcepub fn allow_eval(self) -> Self
pub fn allow_eval(self) -> Self
Allow eval/exec usage.
Sourcepub fn deny_subshells(self) -> Self
pub fn deny_subshells(self) -> Self
Deny subshell usage ($(), backticks, bash -c).
Sourcepub fn allow_subshells(self) -> Self
pub fn allow_subshells(self) -> Self
Allow subshell usage ($(), backticks, bash -c).
Sourcepub fn deny_dangerous_redirects(self) -> Self
pub fn deny_dangerous_redirects(self) -> Self
Deny redirects to sensitive paths (e.g. /etc/*).
Sourcepub fn allow_dangerous_redirects(self) -> Self
pub fn allow_dangerous_redirects(self) -> Self
Allow redirects to sensitive paths.
Sourcepub fn check_command(&self, command: &str) -> Result<BashTokens, String>
pub fn check_command(&self, command: &str) -> Result<BashTokens, String>
Check a raw command string against the policy.
Sourcepub fn check_tokens(&self, tokens: &BashTokens) -> Result<(), String>
pub fn check_tokens(&self, tokens: &BashTokens) -> Result<(), String>
Check tokenized command data against the policy.
Trait Implementations§
Source§impl Clone for BashPolicy
impl Clone for BashPolicy
Source§fn clone(&self) -> BashPolicy
fn clone(&self) -> BashPolicy
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BashPolicy
impl Debug for BashPolicy
Auto Trait Implementations§
impl Freeze for BashPolicy
impl RefUnwindSafe for BashPolicy
impl Send for BashPolicy
impl Sync for BashPolicy
impl Unpin for BashPolicy
impl UnwindSafe for BashPolicy
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
Mutably borrows from an owned value. Read more