Insecure output handling

From thejefflarson/soundcheck · View interactive version

Insecure output handling is an AI agent skill from the GitHub repository thejefflarson/soundcheck. Detects unsafe rendering or execution of LLM output that enables XSS, command injection, or second-order injection. Use when writing code that renders LLM output to a UI, executes LLM-generated code or shell commands, or passes LLM responses to downstream APIs or databases. Also invoke when displayi

How to use this skill

Skill file

Insecure Output Handling Security Check (OWASP LLM02:2025)

What this checks

Protects against XSS, command injection, and second-order injection that arise when

LLM output is treated as trusted. The model may produce malicious content through

prompt injection or hallucination; downstream systems must sanitize it the same way

they would sanitize raw user input.

Vulnerable patterns

Fix immediately

Flag the vulnerable code and explain the risk. Translate the principles below to the

audited file's language, UI framework, and database driver — use that stack's

documented escaping, sanitizer, and parameter-binding APIs.

For each finding, establish these properties:

  1. Treat LLM output as untrusted input at every consumption point. The same

escaping, parameterization, and allowlisting rules that apply to user input

apply here — prompt injection makes the model a proxy for attacker content.

  1. HTML rendering uses a safe sink. Plain-text sink or auto-escaping template

for prose; an allowlist-based sanitizer for rich content. Never a raw-HTML

sink with an unsanitized LLM string.

  1. Shell and code execution require an allowlist. If the LLM picks an

action, the handler validates it against a static set of permitted commands

and invokes them with argv arrays — never with shell expansion enabled, never

through a dynamic-evaluation primitive.

  1. Database queries are parameterized. LLM output lands in bind variables,

not string-interpolated into the statement. For injection details, see the

injection skill.

Verification

Confirm the response:

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.