Skip to content

Close the open DELETE policy on forum_reactions - #256

Merged
rouges78 merged 1 commit into
mainfrom
close-reactions-delete
Nov 26, 2026
Merged

rouges78 merged 1 commit into
mainfrom
close-reactions-delete

Conversation

@rouges78

Copy link
Copy Markdown
Owner

What

Drops the "Community delete reactions" policy on public.forum_reactions (new migration supabase/migrations/20261126090000_close_reactions_delete.sql).

Why

Migration 20260627 added it (FOR DELETE TO public USING (user_id IS NOT NULL)) so anonymous community users could unlike. In practice anyone with the public anon key could delete any reaction and wipe other people's likes.

It is no longer needed:

  • "Authenticated insert reactions" already requires a signed-in user with user_id = auth.uid(), so anonymous users cannot like in the first place.
  • "Author delete reactions" (user_id = auth.uid()) covers the app's unlike path: toggleLike in lib/social/forum.ts deletes the row it found by the user's uid.

Status

  • Already applied to the live gamestringer-community project. The PR keeps the repo's migration history in sync.
  • Verified on live after applying: forum_reactions keeps only the author DELETE, the authenticated INSERT and public SELECT. There is no UPDATE, DELETE or ALL policy left anywhere with USING (true) or IS NOT NULL.
  • The live database also has the tighten_update_policies migration from Harden the app, make String it reachable and undoable, cut dead code #253 applied. Before that, the live UPDATE/ALL policies were already owner-bound, so it re-created them explicitly and recorded the migration.
  • The base schema files do not re-create the dropped policy.

🤖 Generated with Claude Code

"Community delete reactions" (20260627) let anyone holding the anon key
delete any reaction, so other people's likes could be wiped. It is no
longer needed: inserting a reaction already requires a signed-in user
with user_id = auth.uid(), and "Author delete reactions" covers the
app's unlike path (toggleLike deletes the row found by the user's uid).

Already applied to the live gamestringer-community project.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rouges78
rouges78 merged commit 67bdca6 into main Nov 26, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant