Skip to main content

Module security

Module security 

Source
Expand description

Security module for RustyClaw

Provides security validation layers including:

  • SafetyLayer - Unified security defense (recommended)
  • SSRF (Server-Side Request Forgery) protection
  • Prompt injection defense
  • Credential leak detection
  • Input validation

§Components

  • SafetyLayer - High-level API combining all defenses
  • PromptGuard - Detects prompt injection attacks with scoring
  • LeakDetector - Prevents credential exfiltration (Aho-Corasick accelerated)
  • InputValidator - Validates input length, encoding, patterns
  • SsrfValidator - Prevents Server-Side Request Forgery

§Attribution

HTTP request scanning and Aho-Corasick optimization in LeakDetector inspired by IronClaw (Apache-2.0). Input validation patterns also adapted from IronClaw.

Re-exports§

pub use leak_detector::LeakAction;
pub use leak_detector::LeakDetectionError;
pub use leak_detector::LeakDetector;
pub use leak_detector::LeakMatch;
pub use leak_detector::LeakPattern;
pub use leak_detector::LeakScanResult;
pub use leak_detector::LeakSeverity;
pub use prompt_guard::GuardAction;
pub use prompt_guard::GuardResult;
pub use prompt_guard::PromptGuard;
pub use safety_layer::DefenseCategory;
pub use safety_layer::DefenseResult;
pub use safety_layer::PolicyAction;
pub use safety_layer::SafetyConfig;
pub use safety_layer::SafetyLayer;
pub use ssrf::SsrfValidator;
pub use validator::InputValidator;
pub use validator::ValidationError;
pub use validator::ValidationErrorCode;
pub use validator::ValidationResult;

Modules§

leak_detector
Enhanced leak detection (inspired by IronClaw)
prompt_guard
Prompt injection defense layer
safety_layer
Unified security defense layer
ssrf
SSRF (Server-Side Request Forgery) protection
validator
Input validation for the safety layer (inspired by IronClaw)