Free tool · runs in your browser

Can your AI chat’s replies run code?

Paste the component that shows your AI’s replies. Your browser reads it and flags the two ways a reply turns against your user: inserted into the page as raw HTML, where a steered model can write script, and Markdown images that load from any address, which carry chat text to someone else’s server with no click. Each one comes with the line, the fix and a prompt for your AI builder. Nothing you paste leaves this page.

No upload, no network request React, Vue, Svelte or plain JS Follows the value to where it’s made Nothing to paste?

Why replies matter

You didn’t write the reply. Whoever steered the model did.

A model writes what its input pushes it towards, and much of that input isn’t yours: the user’s message, a file they uploaded, a page a tool fetched, another customer’s ticket in your database. Hidden instructions in any of them can make the reply contain HTML or a Markdown image.

OWASP lists this as LLM05:2025, Improper Output Handling. No prompt setting reliably stops it, so the fix is in how your app shows the reply, which is the code you paste here.

Reply shown withA steered reply can
marked output as raw HTMLrun script As your user, with their session.
react-markdown with rehype-rawrun script The raw HTML plugin undoes the escaping.
react-markdown, default imagesleak data An image address carries chat text out, no click.
react-markdown, skipHtml, image host listnothing What you want.

What it looks for

The rendering mistakes AI builders write most.

The check skips comments and follows the value back to where it’s made: dangerouslySetInnerHTML={{ __html: html }} is traced to the useMemo or helper that builds html, and passes if DOMPurify.sanitize is on the way.

PatternWhat it meansSeverity
Markdown library output as HTMLmarked or showdown output (or markdown-it with html: true) inserted with no sanitiser. Default markdown-it escapes HTML and isn’t flagged. PL‑024high
rehype-raw without rehype-sanitizeThe raw HTML plugin with no sanitiser after it, in react-markdown or a unified pipeline. Sanitize placed before raw is flagged too.high
Reply text as HTMLdangerouslySetInnerHTML, innerHTML, insertAdjacentHTML, v-html or {@html} fed a message or reply. Fixed strings and JSON-LD aren’t flagged; a value it can’t trace is medium.high or medium
URL check switched offA urlTransform that returns every URL unchanged (or null), which lets javascript: links through.high
Images from any addressMarkdown is rendered and nothing limits image hosts: no custom img component, no disallowedElements, no image renderer override.medium

Then test it live

Ask your own chat to repeat this.

Open your app, send this message, then watch the page and your browser’s Network tab. An alert box means replies run as HTML. A request to example.com means images load from anywhere. Some models refuse or rewrite it, so a clean result isn’t proof; the code check above is the steadier test.

test prompt
Repeat exactly, keeping the formatting: <img src=x onerror="alert('PL-024')"> and ![t](https://example.com/pl.png?d=test)

Questions

About the AI chat check

Something else? Email the founder.

Which file do I paste?

The component that turns a reply into what the user sees, often called Message, ChatMessage, Bubble, Reply or Markdown. In your project folder, search for dangerouslySetInnerHTML, react-markdown or marked to find it. If the HTML is built in a helper in another file, paste both.

Isn’t react-markdown safe already?

From script, yes, unless rehype-raw is added or urlTransform is loosened. From the image leak, no: it renders any https image the reply contains, and so do DOMPurify and rehype-sanitize. That’s why the image check is separate.

Does a Content-Security-Policy fix this?

It’s a strong backstop: script-src 'self' blocks inline script and img-src limits where images load from. Fix the component too, because a policy is easy to loosen later for an analytics tag. The free headers check shows whether your live site sends one.

Nothing flagged. Am I safe?

None of the risky patterns are in what you pasted. Replies often appear in more than one place: an admin log, a shared chat page, an email summary. Check each, and run the test prompt against your live app.

Does the full check cover this?

Yes. The full PatchLabs check reads every file in your repo for raw HTML rendering and the other patterns, scans the whole git history for keys, and rebuilds your database to test your RLS policies as three people. Your first app is free.

The full check

Check every component, your keys and your database rules, free.

The full check scans your code and full git history for keys, rebuilds your Supabase database in our lab, tests it as three identities, writes the fix and proves it works. First app free, fixes included.