Skip to content

Tighten Supabase RLS for admin-only product writes #5

Description

@davy-patty

Description

Product create/update/delete is currently allowed for any authenticated user. Restrict writes to admin emails (matching NEXT_PUBLIC_ADMIN_EMAILS) while keeping public read access.

Acceptance Criteria

  • Update supabase/schema.sql RLS policies so only admins can insert/update/delete products
  • Public (anon) users can still select products
  • Authenticated non-admins cannot mutate products or upload to the products bucket
  • Document how to mark an admin in Supabase (JWT claim or profiles table)
  • Admin UI continues to work for whitelisted emails

Technical Notes

  • See supabase/schema.sql and lib/products.js
  • Admin check today lives in lib/AuthContext.js via NEXT_PUBLIC_ADMIN_EMAILS
  • Prefer a server-side/RLS source of truth over client-only checks

Labels

enhancement, help wanted

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions