What is XSS?

When a site shows text from users as live code, so one person's message can run in everyone else's browser.

Where XSS goes wrong in real apps

Each of these is a short scenario built from a real failure in an app made with AI. Read the answer here, or walk through it yourself in about four minutes.

  • Working with your AI agent · 4 minutes · Pro

    The chatbot that wrote hidden code

    Your app lets users share AI chat conversations. Everyone who opened one shared chat got signed out, and their sessions were used elsewhere.

    Can AI chatbot replies cause XSS?

    Yes. A user can persuade the model to output HTML with hidden code, such as an image tag with an onerror handler, and if your page inserts replies as raw HTML, that code runs for everyone who views the conversation. Treat model output as untrusted: render it as text, or sanitise Markdown first.

    Read the fix
  • Don't trust the browser · 4 minutes · Pro

    The avatar that ran code

    One user's profile picture is a small grey circle. Everyone who opened it in a new tab was signed out, and their accounts were used elsewhere.

    Can an uploaded SVG image run JavaScript?

    Yes. SVG is a document format that can contain scripts, and when an SVG is opened directly from your domain the script runs like one of your pages. Accept only real raster images, check the file's actual content rather than its name, convert uploads to WebP or PNG, and serve user files from a separate storage domain.

    Read the fix
Browser
Chrome, Safari and friends. Everything that runs here is visible to, and changeable by, the person using it.
Supabase
A popular hosted database with sign-in and file storage built in. Many AI app builders use it behind the scenes.
Policy
One rule in Row Level Security, such as 'people can read only their own orders'.
Session
The app's memory that you are signed in, kept for a while so you don't log in on every page.
Authentication
Checking who someone is, usually by signing in.

All 62 terms in the glossary