Skip to main content

SecurityAnalyzer

Trait SecurityAnalyzer 

Source
pub trait SecurityAnalyzer: Send + Sync {
    // Required methods
    fn analyze_request<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        prompt: &'life1 str,
        context: &'life2 AnalysisContext,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<SecurityFinding>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn analyze_response<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        response: &'life1 str,
        context: &'life2 AnalysisContext,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<SecurityFinding>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn name(&self) -> &'static str;
    fn version(&self) -> &'static str;
    fn supported_finding_types(&self) -> Vec<String>;
    fn health_check<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn analyze_interaction<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        prompt: &'life1 str,
        response: &'life2 str,
        context: &'life3 AnalysisContext,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<SecurityFinding>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
}
Expand description

Trait for security analyzers.

Required Methods§

Source

fn analyze_request<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, prompt: &'life1 str, context: &'life2 AnalysisContext, ) -> Pin<Box<dyn Future<Output = Result<Vec<SecurityFinding>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Analyze a request for security issues.

Source

fn analyze_response<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, response: &'life1 str, context: &'life2 AnalysisContext, ) -> Pin<Box<dyn Future<Output = Result<Vec<SecurityFinding>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Analyze a response for security issues.

Source

fn name(&self) -> &'static str

Get the analyzer name.

Source

fn version(&self) -> &'static str

Get the analyzer version.

Source

fn supported_finding_types(&self) -> Vec<String>

Get supported security finding types.

Source

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

Check if the analyzer is healthy.

Provided Methods§

Source

fn analyze_interaction<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, prompt: &'life1 str, response: &'life2 str, context: &'life3 AnalysisContext, ) -> Pin<Box<dyn Future<Output = Result<Vec<SecurityFinding>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Analyze a complete request/response pair.

Implementors§