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§
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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_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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn sandbox_config(&self) -> SandboxConfig
fn sandbox_config(&self) -> SandboxConfig
Get the current sandbox configuration.
Sourcefn apply_sandbox_config(&self, config: &SandboxConfig)
fn apply_sandbox_config(&self, config: &SandboxConfig)
Apply a sandbox configuration.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".