Create a new InjectionGuard.
Configuration options
OptionalstripAnsi?: booleanWhether to strip ANSI escape sequences (default: true)
Check if text contains ANSI escape sequences.
The text to check
true if the text contains ANSI sequences
Check if text contains potential injection characters.
The text to check
true if the text contains injection characters
Sanitize text to prevent log injection. Replaces newlines and control characters with escaped versions.
The text to sanitize
Sanitized text safe for logging
Injection Guard class for preventing log injection attacks.
Provides:
Example