StoicBuilder
Later missionMission 11: Lock the notesYou can practise it now. It counts once you reach mission 11, after “Keys in the drawer”.Back to HQ

DrillsEveryone can read everyone's notes

Everyone can read everyone's notes

III the CastraQuill, built with LovableSteadyAbout 6 minPro

What happened

Quill's notes page only ever shows your own notes, so you assumed they were private. A tester opened the browser console on the live site and ran one line against Supabase with the public key the page already uses.

A testerRan supabase.from('notes').select('*') in the console and got 214 notes back. Most aren't mine. One is someone's bank PIN reminder.
What you seeDatabase
select * from notes; -- as the tester → 214 rows (the tester owns 6)

The MagisterYou don't have to fix the code yourself. Read it until you can say, in plain words, why it breaks.

create table notes (
  id uuid primary key default gen_random_uuid(),
  user_id uuid not null references auth.users (id),
  title text not null,
  body text,
  created_at timestamptz default now()
);

alter table notes enable row level security;

create policy "Notes are readable"
  on notes for select
  using (true);

create policy "Users can add notes"
  on notes for insert
  with check (true);

This one is for reading: the code needs a real database or server to run.

Your answer

Reviewed by AI against what a good fix needs. About 10 seconds.

Sign in to get your answer reviewed

It's free. Anything you've typed here stays in this browser and is waiting when you come back.

Sign in with email