fix(supabase): address database security advisor warnings - #291
Conversation
…CURITY DEFINER execute grants) Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FJkNvMdqnanZ1HBjMN8vdJ
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Deploy →
|
|
The Resolving the drift (repairing migration history / resetting+reseeding staging) needs someone with access to the staging project and is out of scope for this PR — flagging for a human to handle via Generated by Claude Code |
There was a problem hiding this comment.
Pull request overview
This PR introduces a Supabase migration aimed at clearing database security advisor warnings by hardening function execution contexts, tightening RLS mutation rules, and reducing overly-broad permissions in storage/function execution.
Changes:
- Pins
search_pathon several functions previously lacking an immutablesearch_path. - Replaces always-true
artist_music_genresmutation RLS policies withcan_edit_artists(auth.uid())gating. - Removes a redundant public SELECT policy on
storage.objectsfor thefestival-assetsbucket and revokes EXECUTE on certain SECURITY DEFINER functions.
Suppressed comments (1)
supabase/migrations/20260814120000_fix_security_advisor_warnings.sql:121
- Revoking EXECUTE from
anon, authenticateddoes not prevent access if the function still has the defaultEXECUTEprivilege granted toPUBLIC(which both roles inherit). To fully remove direct client access, revoke fromPUBLICas well.
REVOKE EXECUTE ON FUNCTION public.check_username_exists(text, uuid) FROM anon, authenticated;
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Postgres grants EXECUTE to PUBLIC by default, which anon and authenticated inherit, so revoking only from those roles left the functions callable through the inherited PUBLIC grant. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FJkNvMdqnanZ1HBjMN8vdJ
Playwright test resultsDetails
|
Fixes mutable search_path on 6 functions, tightens always-true RLS policies on
artist_music_genres, dedupes a redundant public-listing storage policy onfestival-assets, and revokes unnecessarySECURITY DEFINERexecute grants (bootstrap_super_admin,check_username_exists,duplicate_set_with_votesforanon).Verification
bootstrap_super_adminandcheck_username_existsRPCs are no longer callable byanon/authenticatedclients.supabase db advisors(or MCPget_advisors) after deploy to confirm the warnings are cleared.Generated by Claude Code