Skip to content

AI output run as code, a command, a query or page HTML

Gaphigh severity · reads .ts .tsx .js .jsx .mjs .cjs .pyBeta

A model's reply can be steered by anyone who can influence its input. Passing it straight to eval, a shell, a database query or innerHTML lets them run code or change data. When Lintsure finds this, it marks it as a Gap: the code itself shows the problem.

What it looks like

A line Lintsure flags in its own test app:

// src/llm.ts
eval(completion.choices[0].message.content);

How to fix it

Treat model output like input from a stranger: validate it against what you expect, escape it for HTML, and never run it as code, a shell command or SQL.

Through a coding agent, Lintsure suggests the change and waits. Nothing is edited until you approve it.

Controls it relates to

What the framework asks

OWASP LLM Top 10 LLM10:2026: Improper Output Handling

Treat what the model returns as untrusted. Never run it as code, a shell command or SQL, and escape it before showing it as HTML.

Evidence a reviewer may ask for: How model output is validated before use.

CWE Top 25 CWE-79, CWE-89, CWE-78, CWE-77, CWE-94: Injection: scripting, SQL, commands and code

Input never becomes part of a page, query, command or code without the right handling.

Summaries are our own reading of the public texts, not the official wording.

Read more: How to reduce prompt injection risk in your AI app

Check your code for this

Runs on your machine. Your code is never uploaded.

npx lintsure scan

Quickstart · Use it in Claude Code or Cursor

This rule is in Beta: its mapping to framework controls is our own reading of the public texts, not independently reviewed. Lintsure is a readiness tool, not an audit or legal advice. A finding, or the lack of one, doesn't make you compliant. Disclaimer

We improve these rules all the time. If you see a false alarm, a missed problem or anything that could work better, tell us in a review and we will use it to improve your experience.

Related rules

Did this rule flag something that's fine, or miss a real problem? Tell us on GitHub. Every report becomes a test case, so the same mistake can't come back.