pub enum DestructivePattern {
Rm {
raw: String,
paths: Vec<String>,
},
PythonRemove {
raw: String,
paths: Vec<String>,
},
McpDelete {
tool_name: String,
paths: Vec<String>,
},
A2ADelete {
paths: Vec<String>,
},
}Expand description
Destructive patterns the guard detects.
Variants§
Rm
Shell: rm, unlink, mv ... /dev/null
PythonRemove
Python: os.remove, os.unlink, shutil.rmtree
McpDelete
MCP: tool named delete_file or similar
A2ADelete
A2A: delete intent in message
Implementations§
Source§impl DestructivePattern
impl DestructivePattern
Sourcepub fn detect_in_shell(cmd: &str) -> Vec<DestructivePattern>
pub fn detect_in_shell(cmd: &str) -> Vec<DestructivePattern>
Scan a shell command string for destructive patterns.
Sourcepub fn detect_in_code(code: &str) -> Vec<DestructivePattern>
pub fn detect_in_code(code: &str) -> Vec<DestructivePattern>
Scan code (Python, etc.) for destructive calls.
Sourcepub fn contains_wildcard(&self) -> bool
pub fn contains_wildcard(&self) -> bool
Check if any path in this pattern contains a wildcard.
Sourcepub fn detect_in_mcp_tool(
tool_name: &str,
arguments: &Value,
) -> Vec<DestructivePattern>
pub fn detect_in_mcp_tool( tool_name: &str, arguments: &Value, ) -> Vec<DestructivePattern>
Check if pattern matches MCP delete_file tool.
Trait Implementations§
Source§impl Debug for DestructivePattern
impl Debug for DestructivePattern
Source§impl<'de> Deserialize<'de> for DestructivePattern
impl<'de> Deserialize<'de> for DestructivePattern
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for DestructivePattern
impl PartialEq for DestructivePattern
Source§fn eq(&self, other: &DestructivePattern) -> bool
fn eq(&self, other: &DestructivePattern) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for DestructivePattern
impl Serialize for DestructivePattern
impl StructuralPartialEq for DestructivePattern
Auto Trait Implementations§
impl Freeze for DestructivePattern
impl RefUnwindSafe for DestructivePattern
impl Send for DestructivePattern
impl Sync for DestructivePattern
impl Unpin for DestructivePattern
impl UnsafeUnpin for DestructivePattern
impl UnwindSafe for DestructivePattern
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