LogicTrail
  • Trails
  • Check my app
  • Pricing
  • Sign in
  1. Trails
  2. /
  3. Don't trust the browser
  4. · 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.

This answers: Can an uploaded SVG image run JavaScript? No coding needed. 3 quick decisions.

  • Who may see what
  • Keeping data safe

Checking your access…

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.

Trail of the bug
  1. Stranger
  2. File storage
  3. Browser

Breaks at File storage: SVG served from your own domain

Why AI tools write this bug

Upload code from AI tools usually checks the file extension or the browser's content type, both of which the uploader controls.

How to fix it

  1. Reject SVG for user uploads, or it strictly.

3 more steps, and a prompt that checks your own app for this bug. Part of Pro.

Unlock

Common questions

Is Supabase Storage safe for user uploads?
It serves files from its own domain, which keeps scripts away from your app's sign-in. Still convert images and limit file types.

Related scenarios

  • The bucket of ID photosPro · 4 min
  • No account with that emailPro · 3 min
  • The share link next doorPro · 3 min

More on this trail

Don't trust the browser: Prices, webhooks, uploads, form limits and coupons: what visitors can change, and what your server must decide.

Want someone to look?

We check AI-built apps for this and three other common leaks, in plain English.

Check my app
Sign in

Sign in to walk this one

3 decisions, about 4 minutes, and a prompt to check your own app for the same problem.

Sign in No password. We email you a link.

How to fix it

  1. Reject SVG for user uploads, or it strictly.

3 more steps, and a prompt that checks your own app for this bug. Part of Pro.

Unlock