low · M3 · MASVS-AUTH-2 · PTKD-BACKEND-SUPABASE-RLS-NO-POLICY

    Supabase table with RLS on but no policy at all

    Row Level Security is enabled on a public table, but no migration creates a policy for it. The table is closed to the app's users (every query returns nothing), which usually means the app reaches it some other way: with the service_role key, or through a view or SECURITY DEFINER function. Those paths skip RLS.

    How it is exploited

    The table was locked down with RLS but no policies, the app 'broke', and the quick fix was to call it with the service_role key from the app. That key now ships in the build and opens every table.

    Why it matters

    On its own the data is safe but unusable; the usual workaround (service key, definer view) removes all protection.

    How to fix it

    1. List what the app needs from the table per operation.
    2. Write one policy per operation tied to the signed-in user.
    3. Remove any service_role key from the app and rotate it.

    Does your app have this?

    PTKD checks your build or your source project for PTKD-BACKEND-SUPABASE-RLS-NO-POLICY and every other check in this knowledge base.

    Scan your app

    References

    Related checks (M3)