Agent Output Escaping & Encoding
Ensure agent-generated content is safe for the downstream UI or system execution by preventing script execution.
Steps
- HTML-escape all agent output before rendering in a web browser (Prevent XSS).
- Validate and JSON-encode data intended for downstream API consumption.
- Sanitize Markdown syntax to prevent unauthorized image or link hijacking.
- Enforce UTF-8 character encoding consistency across all output channels.
- Mask PII or sensitive secrets in logs while preserving the user-facing output.
- Verify output length and structure against the 'Definition of Done' contract.