#6 of 10Depends

Endpoints and functions without access checks

An endpoint is unprotected when the server does what it's asked without checking who's calling. Hiding a button in your UI doesn't help: anyone can read your site's code and call the API route, edge function or database function directly. The fix: check the signed-in user, and their right to that specific record, inside every handler.

Where it shows up: API routes, Supabase Edge Functions and database (RPC) functions

Are you affected? The 60-second check

List what your frontend calls. These searches find most of it:

Terminal
grep -rnE "/api/|functions\.invoke|\.rpc\(" src app 2>/dev/null

For each one, ask: if someone calls this signed out, or signed in as a different user, does the server refuse? Test it against your own app with a test record. Shippable lists these endpoints in your report; AI Red Team tests them for real.

What it is

Every endpoint your frontend calls can also be called directly, without your app's UI. Hiding a button doesn't protect the action behind it.

AI tools often check permissions in the page ("only admins see this button") but not in the endpoint itself, so the endpoint trusts whoever calls it.

How often we see it

We ran Shippable's static checks on about 25,000 public GitHub repos built with five AI tools (October 2026). Each figure is the share of that builder's repos where the check fired at least once. A dash means we saw it in under 1% of that builder's repos. Full method and breakdown: Which AI builder ships the safest apps?

FindingBoltLovableCursorReplitv0
Payment webhook anyone can fake1.1%––––
Function acts on any record id it's sent1.7%––––
Admin-rights DB function anyone can call14.6%3.2%1.1%––
Edge function with no access check11.3%2.7%–––

What an attacker sees

Someone reads your site's code, finds a route like /api/admin/export-users, and calls it directly. If the server doesn't check who is calling, it does what it's asked.

How to fix it

Paste this into your AI tool:

Paste the prompt below into your vibecoding tool

Review every API endpoint, edge function and database function my frontend calls. For each one, confirm the server checks that the caller is signed in and allowed to do that specific action on that specific data, before doing anything. Never rely on checks that only happen in the frontend. For database functions that shouldn't be public, revoke EXECUTE from the anon role.

Supabase SQL editor
-- Stop anyone calling a function that isn't meant to be public: REVOKE EXECUTE ON FUNCTION public.admin_export_users() FROM PUBLIC, anon, authenticated; -- Functions users may call should check the caller themselves: -- IF auth.uid() IS NULL THEN RAISE EXCEPTION 'not signed in'; END IF; -- and SECURITY DEFINER functions should pin their search_path: ALTER FUNCTION public.my_function() SET search_path = '';

Or by hand:

  1. List the endpoints from your Shippable report.
  2. In each handler, check the signed-in user and their permission for the specific record before acting.
  3. Revoke public EXECUTE on database functions that don't need to be callable by anyone.

Mistakes that look fixed but aren't

  • Checking that someone is signed in, but not that the record belongs to them. /api/orders/123 must refuse other users' orders.
  • Taking the user ID, role or price from the request body instead of from the session.
  • Relying on Supabase's JWT check for edge functions. The public anon key is a valid JWT, so that check alone doesn't prove anyone signed in.
  • SECURITY DEFINER database functions. Postgres lets everyone execute new functions by default, and these run with the owner's rights.

Check your app

Shippable lists the endpoints and database functions your site's code refers to, so you can review each one. It never calls them, because that wouldn't be read-only. Testing them for real is what AI Red Team is for.

Scan your dev server before you push. No account needed:

Terminal
npx shippable-dev scan localhost:5173

Or scan your live app in the browser:

FAQ

Can people call my Supabase RPC functions directly?

Yes. Functions in the public schema can be called by anyone with the anon key unless you revoke EXECUTE. 15% of Bolt repos in our scan had an elevated-rights function anyone could call.

Is hiding the admin page enough?

No. The page is only the UI. The data comes from endpoints, and those can be called without it.

How should an edge function check the caller?

Read the user's access token from the Authorization header, ask Supabase Auth who it belongs to (auth.getUser), and refuse with 401 if there's no user. Then check that user may act on the specific record.

Related questions