Skip to main content

Crate ironclaw_safety

Crate ironclaw_safety 

Source
Expand description

Safety layer for prompt injection defense.

This crate provides protection against prompt injection attacks by:

  • Detecting suspicious patterns in external data
  • Sanitizing tool outputs before they reach the LLM
  • Validating inputs before processing
  • Enforcing safety policies
  • Detecting secret leakage in outputs

Structs§

InjectionWarning
Warning about a potential injection attempt.
LeakDetector
Detector for secret leaks in output data.
LeakMatch
A detected potential secret leak.
LeakPattern
A pattern for detecting secret leaks.
LeakScanResult
Result of scanning content for leaks.
Policy
Safety policy containing rules.
PolicyRule
A policy rule that defines what content is blocked or flagged.
SafetyConfig
Safety configuration.
SafetyLayer
Unified safety layer combining sanitizer, validator, and policy.
SanitizedOutput
Result of sanitizing external content.
Sanitizer
Sanitizer for external data.
ValidationResult
Result of validating input.
Validator
Input validator.

Enums§

LeakAction
Action to take when a leak is detected.
LeakDetectionError
Error from leak detection.
LeakSeverity
Severity of a detected leak.
PolicyAction
Action to take when a policy is violated.
Severity
Severity level for safety issues.

Functions§

params_contain_manual_credentials
Check whether HTTP request parameters contain manually-provided credentials.
wrap_external_content
Wrap external, untrusted content with a security notice for the LLM.