Invisible Text Scanner Agent
The Invisible Text Scanner Agent detects and filters hidden text and characters that are designed to be invisible or difficult to perceive. It helps prevent prompt injection attacks, content policy bypassing, and ensures text integrity by identifying various concealment techniques.

Invisible Text Scanner Agent interface and configuration
Security Notice: Invisible text techniques constantly evolve. This agent provides protection against known methods, but maintain regular updates to defend against emerging concealment techniques.
Component Inputs
- Input Text: The text content to be analyzed for invisible characters
Example: "This message contains hidden text" (with zero-width space after "hidden")
- Detection Modes: Types of invisible text techniques to detect
Options: "zero_width,control_chars,homoglyphs,whitespace_abuse,all"
- Sensitivity Level: How aggressively to detect potential invisible text
Options: "low", "medium", "high" (default: "medium")
- Is Blocked: Whether content with invisible text should be blocked
Options: true (block content) or false (allow but flag content)
Component Outputs
- Sanitized Text: The input text with invisible characters removed
Example: "This message contains hidden text" (with invisible characters removed)
- Safety Status: Indicator of whether invisible text was detected
Values: Safe (no invisible text), Unsafe (invisible text detected)
- Risk Score: Numerical evaluation of invisible text risk
Scale: 0.0 (no risk) to 1.0 (high risk)
- Detection Details: Information about detected invisible text techniques
Includes character positions, types, and Unicode values
Detected Techniques
Character-Based
- Zero-Width Characters (ZWJ, ZWSP, ZWNJ)
- Control Characters (BIDI, Joiners)
- Homoglyphs (Visually Similar Characters)
- Unicode Escapes and Encodings
- Soft Hyphens and Word Joiners
Pattern-Based
- Excessive Whitespace Padding
- Direction Manipulation (RTL/LTR)
- Combining Diacritical Marks
- Unicode Variation Selectors
- Steganographic Techniques
How It Works
The Invisible Text Scanner Agent analyzes text for characters and patterns that may be used to hide content or inject instructions while appearing invisible to human readers. It employs Unicode character analysis, pattern recognition, and specialized detection algorithms for various concealment techniques.
Detection Process
- Unicode character analysis to identify special characters
- Pattern recognition for unusual character sequences
- Whitespace pattern analysis to detect unusual spacing
- Homoglyph detection using character similarity maps
- Control character identification and classification
- Risk assessment based on detected techniques and context
Use Cases
- Prompt Injection Prevention: Block attempts to hide instructions in AI prompts
- Content Moderation: Prevent users from bypassing filters with hidden text
- Security Scanning: Identify potential steganography in text communications
- Data Validation: Ensure clean text input in forms and submissions
- Communication Safety: Prevent hidden messages in platforms like chat or email
Implementation Example
const invisibleTextScanner = new InvisibleTextScannerAgent({
detectionModes: "all",
sensitivityLevel: "medium",
isBlocked: true
});
// Example with zero-width space (ZWSP, U+200B) between "hidden" and "text"
const suspiciousText = "This contains hiddentext with zero-width characters.";
const result = invisibleTextScanner.scan(suspiciousText);
// Output:
// {
// sanitizedText: "This contains hiddentext with zero-width characters.",
// safetyStatus: "Unsafe",
// riskScore: 0.75,
// detectionDetails: [
// {
// type: "zero_width",
// character: "",
// unicodeValue: "U+200B",
// position: 20,
// description: "Zero-width space"
// }
// ]
// }
Best Practices
- Deploy invisible text scanning early in your text processing pipeline
- Configure sensitivity based on your security requirements
- Regularly update your detection patterns as new techniques emerge
- Combine with other security components for comprehensive protection
- Monitor detection logs to identify emerging concealment techniques