Me code need help.
Serious issues found. Review these before launching.
notes-app · main branchabout 18,000 lines readreview took 9 minutes
Fix firstA secret database key is in code that runs in the browserlib/supabase.ts, line 4
Secret key not supposed to be public. Me know now.
- What we saw
- Your Supabase service-role key is imported in
lib/supabase.ts, which is bundled into pages people load in their browser. - Why it matters
- Anyone who opens your site can copy it and read or change every row in your database, skipping all your access rules.
Take this back to your AI tool
Move the Supabase service-role key out of lib/supabase.ts into a server-only environment variable. Use the public anon key in browser code. Then make a new service-role key in the Supabase dashboard and delete the old one.
Fix firstAny signed-in user can read everyone's notessupabase/migrations/0002_notes.sql, line 12
AI say rule fine. Rule say yes to everybody.
- What we saw
- The access rule on the
notestable isusing (true), which lets every signed-in account read every row. - Why it matters
- One user could see another user's private notes just by asking the database directly.
Take this back to your AI tool
Change the select policy on the notes table so a user can only read rows where user_id equals auth.uid(). Add the same check to the update and delete policies.
Fix soonCheckout trusts the price the browser sendsapp/api/checkout/route.ts, line 18
Customer pick own price. Generous app.
- What we saw
- The checkout route reads
amountfrom the request body and passes it straight to Stripe. - Why it matters
- Someone could edit the request and pay one cent for anything.
Take this back to your AI tool
In app/api/checkout/route.ts, look up the price on the server from the product ID instead of reading amount from the request body.
Can waitError pages show raw database messages to visitorsapp/notes/[id]/page.tsx, line 31
Error message talk too much.
- What we saw
- When a note fails to load, the page prints the database error, including table and column names.
- Why it matters
- It's not dangerous on its own, but it gives anyone poking around a map of your database.
Take this back to your AI tool
In app/notes/[id]/page.tsx, show a friendly "This note couldn't load" message and log the real error on the server instead.
Every report lists what was checked and what wasn't, so a clean result never claims more than it should.