Most AI-built apps end up with a file upload somewhere. A profile photo, or a receipt a user wants to attach. Ask Lovable, Cursor, Bolt or Claude Code to add one and you get a working form in minutes: pick a file, press upload, and the image appears where it should.
What you get is the happy path. What you do not get is everything that happens when someone uploads something they shouldn't. And uploads are one of the places where the gap between the two is widest, because the code you can see (the form) is only a small part of the feature. The rules that decide what is allowed to land on your server sit in settings the AI never opened.
Here is what generated upload code usually does, three tests you can run on your own app this afternoon, and what a proper fix looks like.
The AI builds the form, not the rules
A typical AI-generated upload has three parts: an <input type="file"> on the page, a handler that sends the file to storage, and a bucket or folder that holds it. Each part has a way to say what is allowed, and each one defaults to trusting the others.
The accept attribute on the input is a hint to the file picker, not a rule. Nothing stops anyone from sending a request to your upload endpoint directly, with any file they like, using curl or their browser's developer tools. If your only check on file type lives in the HTML, it does not exist.
Size is the same story. The preview will happily handle a 2 MB photo. It will also happily handle a 2 GB file, unless somebody put a limit in the code, the hosting config and the storage bucket. Most generated apps have a limit in none of those places.
And almost nothing in a generated app checks the file's real contents. A file named invoice.pdf is not necessarily a PDF. Its contents could be anything at all, and by default your app will accept it and store it.
Three tests you can run this afternoon
Change the file type
Take a normal photo, rename it to test.exe (or any extension your app should refuse), and upload it. If your app accepts it, the extension check is either missing or client-side only. Then try the sharper version: open the upload request in your browser's Network tab, copy it as a curl command, and change the file's contents but keep the name. If that still succeeds, the app is judging books by their covers.
Upload something enormous
Try a file far bigger than anything a real user would send. Watch what happens: does the request fail cleanly, hang, or slow the whole app down? Files need somewhere to sit, and unbounded uploads fill up storage and can push you into paid bandwidth you did not budget for. This is the boring version of a denial of service, and it needs no skill to carry out.
Open a file you already uploaded in a private window
Find the URL of a file you uploaded, open a private browser window, and paste it in. If it loads while you are logged out, then every file in that location is public to anyone who knows or guesses a URL. Then the sharper question: are the file names random? If they are, fine. If they are sequential or derived from the user's name, the whole folder is effectively readable.
Supabase storage is where most of this goes wrong
Plenty of AI-built apps use Supabase for storage, and it is a good choice. But its defaults do not give you a secure upload. Buckets have policies, just like database tables, and the AI regularly creates a bucket, marks it public, and writes a permissive policy so the demo works. It will not come back later and tighten it.
Go to Storage in your Supabase dashboard and read the policies on every bucket. Two questions matter for each one. Can a signed-out visitor read files in this bucket, and is that intentional? Can any signed-in user write to this bucket, or only uploads that belong to them?
If your app uses Supabase for its database as well, the same thinking applies to the policies on your tables. We wrote a full walkthrough of row level security mistakes in a separate post, and the storage version of the mistake looks very similar.
A safe upload can still be dangerous to serve
Even a correctly validated file carries risk once it is stored, depending on what your app does with it afterwards.
The sharpest edge is serving a file back with the wrong type. If someone uploads a file that is really HTML, and your app serves it from your domain with an HTML content type, the browser will render it as a page on your site. That page can run scripts in your app's domain, which breaks the protections browsers rely on to keep one site's code away from another's. It also turns your storage into free hosting for somebody else's phishing page, which is how upload abuse usually shows up in practice.
The usual fixes are to serve uploads from a separate domain, to force the browser to download rather than render anything you did not intend to display, and to set an explicit content type for every file rather than trusting the uploaded one. AI-generated apps almost never do any of this unless you asked.
What a proper fix looks like
None of this is exotic, and you can describe every part of it to your AI in one message:
Decide the file types you actually accept, and check the file's real contents on the server, not just its name. Checking the first bytes of the file is a good start.
Set a size limit in the upload code and in the storage bucket, at whatever your app genuinely needs.
Give every stored file a random name, so nobody can guess another user's file from yours.
Make each storage bucket's policy deliberate: public only for files that genuinely should be public, with write access limited to the owner of the upload.
Serve uploads from a separate domain or force downloads for anything that is not meant to be a web page.
Run the three tests again afterwards. Renamed executables should be refused, huge files should fail fast with a clear message, and private files should stay private in a logged-out browser.
How far you need to go
An app where only the founder uploads files, and those files are internal documents, needs far less than an app where strangers upload photos that other strangers can view. Match the effort to what the upload actually holds.
If you want a second pair of eyes, our free surface check looks at what anyone on the internet can already see about your app, with nothing attacked or logged into. For the full picture, the launch-readiness audit tests an app against 137 points in 14 areas, including what your app does with input it was never built to expect, and a developer confirms every finding. It is not a penetration test, and no review can promise an app is free of security problems. But if an upload endpoint is open, it is the kind of thing you would rather find yourself than have a stranger find for you.