pub trait CommandAllowList: Send + Sync {
// Required methods
fn is_allowed(&self, command: &str) -> bool;
fn add_session_pattern(&self, pattern: &str);
}Expand description
Trait for checking whether a command is allowed to execute.
Implementations live in the app layer; tools receive this as
Arc<dyn CommandAllowList>. When no allow-list is set (e.g. in tests
or desktop), all commands execute freely.
Required Methods§
Sourcefn is_allowed(&self, command: &str) -> bool
fn is_allowed(&self, command: &str) -> bool
Check whether a command is pre-approved (permanent config or session).
Sourcefn add_session_pattern(&self, pattern: &str)
fn add_session_pattern(&self, pattern: &str)
Record a session-level approval pattern (glob-style).
The pattern argument expects a glob-style string (e.g. "git commit -m '*'",
"cargo build"). Patterns are matched against the full command line at execution time.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".