I built tastebox, a film taste app for Turkish movie fans, mostly with AI help. Next.js on Vercel, a small Python API on Render, Supabase for the database and auth. Real people use it. I was using Letterboxd and wanted to compare my film taste with my friends, and I thought other people would find that useful too.

Before I started promoting it with TikTok videos, I wanted to know one thing: what happens if someone tries to break it?

So I ran a security audit on my own app. I used AI-assisted code review to go through the whole codebase quickly, then I tested every finding by hand against the live app. Here's what came out, including one fix that broke my own app.

The good news first

No critical holes. No way to log in as someone else, no way to read another user's data by changing an ID, no SQL injection, no XSS, no secret keys in the browser bundle. All 23 Row Level Security policies did what they should.

If you built your app with Lovable or Bolt, this is the part people focus on, and it matters. But a correct RLS setup was not where my problems were.

Problem 1: anyone could fill my database in minutes

I had two analytics tables where anonymous visitors can insert rows (page views, funnel steps). RLS allowed insert for anon, which is normal for analytics.

What I didn't think about: the Supabase API accepts an array of rows in one request. One insert with 10,000 rows is a single HTTP call. The free tier has a 500 MB database. You do the math.

The fix was a statement-level trigger that counts the rows in each insert:

create or replace function public.limit_event_inserts() returns trigger language plpgsql security definer set search_path = public as $$ declare n int; begin select count(*) into n from new_rows; if n > 5 then raise exception 'too many rows' using errcode = '54000'; end if; execute format( 'select count(*) from public.%I where created_at > now() - interval ''1 day''', tg_table_name) into n; if n > 30000 then raise exception 'daily limit' using errcode = '54000'; end if; return null; end; $$; create trigger funnel_events_limit after insert on public.funnel_events referencing new table as new_rows for each statement execute function public.limit_event_inserts(); 

Plus a pg_cron job that deletes rows older than 90 days.

The part I got wrong: my first version didn't have security definer. The trigger ran as the anon role, and anon can insert but can't read the table. So the daily count failed and every normal single-row insert got rejected too. My analytics silently stopped. I only caught it because I tested on the live site afterwards: 1 row → accepted, 6 rows → rejected. Always test the happy path after a security fix.

Problem 2: a 46 KB file that unzips to 32 MB

Users can upload their Letterboxd export (a ZIP of CSV files). A ZIP bomb is a tiny file that expands to something huge. Mine was 46 KB and unpacked into four 8 MB CSVs. Parsing that kept the server busy for about 50 seconds.

The fix: check the unzipped size of each file before reading it (the ZIP header tells you), limit the number of files and the compression ratio, cap the rows at 30,000, and only read the columns I actually use. I also rewrote the parsing with vectorized pandas code. A million rows went from minutes to almost instant, with exactly the same output.

Problem 3: the size limit that wasn't

My API rejected requests with a large Content-Length. But if a client sends the body chunked, there is no Content-Length header at all, and my check simply didn't run. In testing, a 300 MB body was read into memory.

Fix: requests without a known length now get 411 Length Required. Boring, one line, important.

Problem 4: my server would call any URL you gave it

Push notifications work like this: the browser gives you a subscription URL, and your server sends a request to it. My endpoint accepted any https URL. That means an attacker could make my server send requests to addresses of their choice (this is called SSRF).

Fix: only accept URLs on the real push services (Google, Mozilla, Apple), remove subscriptions that fail, and compare the cron token with hmac.compare_digest instead of !=.

The smaller ones

  • An unauthenticated endpoint looked up any key in a third-party API (TMDB) and cached the result. Anyone could burn my API quota and fill a table with junk. Now it only looks up keys that exist in my own data.
  • A background job had no per-user lock. 30,000 fake items could start hours of API calls. Now: max 1,500 items, max 2 jobs at once, one per user.
  • Game votes could be spammed. Now: max 30 per IP per day.
  • Users could save any image URL to their profile. External images can track who views the page. A CHECK constraint now allows only the trusted image host.
  • HSTS without includeSubDomains, and a service worker that could open another site on notification click.

What I'd check first in any Lovable / Bolt app

You don't need to read code for most of these:

  1. Open Supabase → Advisors → Security Advisor. Fix everything red. It's free and takes five minutes.
  2. Look at every table where anon can insert. Contact forms, waitlists, analytics. Ask: what stops someone from inserting a million rows?
  3. Check your Storage buckets. Is anything marked public that shouldn't be?
  4. Search your deployed site for service_role. Open the site, press F12, search the JavaScript files. If that key is in there, anyone has full access to your database.
  5. Do you have a backup you've actually restored? I set up a weekly encrypted pg_dump with GitHub Actions, then downloaded it, restored it and compared row counts table by table. Most people have never tried, and a backup you haven't restored is a hope, not a backup.

The full list with all fixes is in this case study.

I'm a student who builds with AI tools, and I now help other people check and fix their Supabase / Next.js apps. If you want a second pair of eyes on yours, leave a comment or send me a message.

I wrote this post with help from AI tools. The app, the audit findings, the fixes and the live tests are real and from my own project.