Skip to main content

ToolSecurity

Trait ToolSecurity 

Source
pub trait ToolSecurity: Send + Sync {
Show 13 methods // Required methods fn evaluate_tool_policy<'life0, 'life1, 'async_trait>( &'life0 self, tool_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<ToolPermissionDecision>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_tool_policy<'life0, 'life1, 'async_trait>( &'life0 self, tool_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = ToolPolicy> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn set_tool_policy<'life0, 'life1, 'async_trait>( &'life0 self, tool_name: &'life1 str, policy: ToolPolicy, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn mark_tool_preapproved<'life0, 'life1, 'async_trait>( &'life0 self, tool_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn enable_full_auto_permission<'life0, 'life1, 'async_trait>( &'life0 self, allowed_tools: &'life1 [String], ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn disable_full_auto_permission<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn is_allowed_in_full_auto<'life0, 'life1, 'async_trait>( &'life0 self, tool_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn is_denied_in_full_auto<'life0, 'life1, 'async_trait>( &'life0 self, tool_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn apply_config_policies<'life0, 'life1, 'async_trait>( &'life0 self, tools_config: &'life1 ToolsConfig, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn sandbox_config(&self) -> SandboxConfig; fn apply_sandbox_config(&self, config: &SandboxConfig); fn persist_approval_cache_key<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn has_persisted_approval<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait;
}
Expand description

Security and policy enforcement for tool execution.

Encapsulates policy evaluation, sandbox configuration, approval management, and shell policy checks. Implementors can provide different security postures (e.g., auto-approve for CI, prompt-for-everything in interactive).

Required Methods§

Source

fn evaluate_tool_policy<'life0, 'life1, 'async_trait>( &'life0 self, tool_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<ToolPermissionDecision>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Evaluate the permission policy for a given tool.

Source

fn get_tool_policy<'life0, 'life1, 'async_trait>( &'life0 self, tool_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = ToolPolicy> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the current policy for a tool.

Source

fn set_tool_policy<'life0, 'life1, 'async_trait>( &'life0 self, tool_name: &'life1 str, policy: ToolPolicy, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Set the policy for a specific tool.

Source

fn mark_tool_preapproved<'life0, 'life1, 'async_trait>( &'life0 self, tool_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Mark a tool as pre-approved for a single execution.

Source

fn enable_full_auto_permission<'life0, 'life1, 'async_trait>( &'life0 self, allowed_tools: &'life1 [String], ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Enable full-auto mode with an allowlist of tools.

Source

fn disable_full_auto_permission<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Disable full-auto mode.

Source

fn is_allowed_in_full_auto<'life0, 'life1, 'async_trait>( &'life0 self, tool_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check if a tool is allowed in full-auto mode.

Source

fn is_denied_in_full_auto<'life0, 'life1, 'async_trait>( &'life0 self, tool_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check if a tool is denied by the full-auto allowlist.

Source

fn apply_config_policies<'life0, 'life1, 'async_trait>( &'life0 self, tools_config: &'life1 ToolsConfig, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Apply tool policies from configuration.

Source

fn sandbox_config(&self) -> SandboxConfig

Get the current sandbox configuration.

Source

fn apply_sandbox_config(&self, config: &SandboxConfig)

Apply a sandbox configuration.

Source

fn persist_approval_cache_key<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Persist an approval cache key for future sessions.

Source

fn has_persisted_approval<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check if an approval has been persisted.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§