rustyclaw_core/security/mod.rs
1//! Security module for RustyClaw
2//!
3//! Provides security validation layers including:
4//! - **SafetyLayer** - Unified security defense (recommended)
5//! - SSRF (Server-Side Request Forgery) protection
6//! - Prompt injection defense
7//! - Credential leak detection
8//! - Input validation
9//!
10//! # Components
11//!
12//! - `SafetyLayer` - High-level API combining all defenses
13//! - `PromptGuard` - Detects prompt injection attacks with scoring
14//! - `LeakDetector` - Prevents credential exfiltration (Aho-Corasick accelerated)
15//! - `InputValidator` - Validates input length, encoding, patterns
16//! - `SsrfValidator` - Prevents Server-Side Request Forgery
17//!
18//! # Attribution
19//!
20//! HTTP request scanning and Aho-Corasick optimization in `LeakDetector`
21//! inspired by [IronClaw](https://github.com/nearai/ironclaw) (Apache-2.0).
22//! Input validation patterns also adapted from IronClaw.
23
24pub mod leak_detector;
25pub mod prompt_guard;
26pub mod safety_layer;
27pub mod ssrf;
28pub mod validator;
29
30pub use leak_detector::{
31 LeakAction, LeakDetectionError, LeakDetector, LeakMatch, LeakPattern, LeakScanResult,
32 LeakSeverity,
33};
34pub use prompt_guard::{GuardAction, GuardResult, PromptGuard};
35pub use safety_layer::{
36 DefenseCategory, DefenseResult, PolicyAction, SafetyConfig, SafetyLayer,
37};
38pub use ssrf::SsrfValidator;
39pub use validator::{InputValidator, ValidationError, ValidationErrorCode, ValidationResult};