medium · M3 · MASVS-AUTH-2 · PTKD-LIVE-SUPABASE-RPC-EXPOSED

    Database functions callable with the public key

    The REST schema served to the anon key lists database functions under /rpc/. Anyone with the app can call them with arguments of their choice; a SECURITY DEFINER function skips RLS entirely.

    How it is exploited

    The attacker reads the function list from GET /rest/v1/ and calls POST /rest/v1/rpc/admin_reset_credits with any user id.

    Why it matters

    Business logic and data changes reachable by anyone, often without the checks the app UI performs.

    How to fix it

    1. Review each listed function: who should call it?
    2. Revoke execute from anon/public for internal ones.
    3. Set search_path and check auth.uid() in the rest.

    Does your app have this?

    PTKD checks your build or your source project for PTKD-LIVE-SUPABASE-RPC-EXPOSED and every other check in this knowledge base.

    Scan your app

    References

    Related checks (M3)