PeekLok

Can anyone call my Supabase Edge Function? A check for Lovable and Bolt apps

Short answer: possibly, even with the default settings. If your Lovable or Bolt app uses Supabase Edge Functions to send email, call an AI model or change data, Supabase's own docs say the built-in verify_jwt check “alone doesn't authenticate a caller that sends only an API key.” Your app's publishable key is in the code every visitor downloads. Here are four checks.

Free scan: check my app Just your web address. Results in seconds. No signup, no card.

Lovable's Supabase docs list Edge Functions for payments, emails and AI features, and Bolt's docs show Bolt writing an Edge Function when you ask, for example one that talks to OpenAI. v0 builds Next.js apps, which can also have their own API routes. If your v0 app calls Supabase Edge Functions, the checks below apply as they are. For its Next.js routes, see v0: Missing auth on endpoints.

1. Know what verify_jwt does and doesn't do

Every request to an Edge Function passes a platform check called verify_jwt before your code runs. Supabase's config reference says it is on by default, and it rejects requests without a valid JWT in the Authorization header.

The catch is on Supabase's Authorization headers page: for migration compatibility, the check also accepts publishable and secret keys. So someone who copies your publishable key from your site can get past it. It stops random requests, but it does not prove the caller is a signed-in customer.

2. Look for functions with verify_jwt = false

Open supabase/config.toml in your project (or ask the AI in the Lovable or Bolt chat to show it) and look for lines like verify_jwt = false. Supabase warns this “will allow anyone to invoke your Edge Function without a valid JWT.”

That is correct for a Stripe or GitHub webhook, which must then check the provider's signature in code, as Supabase's webhook example does. It is not correct for a function your own app calls for a signed-in user. Supabase's docs say to leave it on for user-facing functions, and warn that turning it off to clear a 401 during development removes the platform's check.

3. Make each function check the user itself

For any function that reads or changes a customer's data, the code inside should get the user from their session token and refuse if there isn't one. It should use that verified user ID, never a user ID sent in the request body. Supabase's guide on securing functions shows this with auth: 'user', which gives the function a database client that follows your Row Level Security rules. (More on those rules in Lovable: Supabase RLS turned off.)

Be extra careful with functions that use the secret or service role key. That key skips every database rule, so the function's own checks are all that stand between a stranger and your data. See Lovable: Exposed anon or service role key.

4. Test it while signed out

In your live app, press F12, open the Network tab and use the feature that calls the function. Note the function's URL, which contains /functions/v1/ and the function name. Then call that URL from a private browser window or a tool like curl with only your publishable key and no signed-in session. A user-only function should refuse. If it returns data, sends an email or runs up an AI bill, anyone can do the same.

Fix prompt to paste into the Lovable or Bolt chat

List every Supabase Edge Function in this project and how it is called. For each function that is called by signed-in users, keep verify_jwt on and make the function itself verify the user's session token and return 401 if it is missing or invalid. Use the user ID from the verified token, never from the request body. Only webhook functions may use verify_jwt = false, and those must verify the provider's signature. Don't use the service role key unless the function checks the user first. Show me a table of each function and the check you added.

After the AI makes changes, test again signed out and as two different users. AI fixes can look right and still miss a function.

Sources

Related

Get a free scan

PeekLok checks your live app for secret keys in the page code, Supabase keys and tables anyone can read, and five security headers. With two test logins it also checks whether one user can see the other’s data. It doesn’t test Edge Functions yet, so use the steps above for those. Only scan apps you own. First scan free. Weekly re-checks will be $12 US a month once payments open.

Start my free scan