Skip to content

Guides · VibeVigil

Can Anyone Call My Supabase Edge Function? How to Check and Lock It Down

Your Supabase Edge Functions have a public URL. If verify_jwt is off, or your code never checks the user, a stranger can call them, run up your AI bill or read data. Here's a 10-minute check and the fix for Lovable, Bolt and Cursor apps.

Not sure your app is safe? Run a free scan first.
VibeVigil checks your live web app for exposed keys, Supabase tables a stranger can read, missing security headers, SSL problems and downtime. Every issue comes with a ready-to-paste prompt for your coding agent.
Scan my app for free → (only scan apps you own)

Note: the scan does not call your Edge Functions. Use the steps below to test them yourself.

Can Anyone Call My Supabase Edge Function? How to Check and Lock It Down

Your Lovable, Bolt or Cursor app probably uses Supabase Edge Functions. They do the "secret" work: calling OpenAI, sending emails, taking Stripe payments, or changing data with the service role key.

Here is the catch: every Edge Function has a public web address. Anyone who knows it can send it a request. The only question is whether your function says no.

This guide shows you how to check in about 10 minutes, and how to fix it. Only test projects you own.

The short answer

  1. Edge Functions live at a public URL like https://YOUR-PROJECT.supabase.co/functions/v1/FUNCTION-NAME. Your project address is in your website's code, so it is not a secret.
  2. verify_jwt = false means anyone can call it. Supabase warns that this setting "will allow anyone to invoke your Edge Function without a valid JWT" (Supabase: Function configuration).
  3. verify_jwt = true is not the same as "logged-in users only." Supabase says this check also accepts your publishable and secret keys, and "the check alone doesn't authenticate a caller that sends only an API key" (Supabase: Authorization headers). Your publishable (anon) key is in your website's code, so a stranger has it too.
  4. The real fix is inside the function: check who the user is, and only do work for them.
  5. If the function uses the service role key, be extra careful. It skips Row Level Security (RLS). If you don't filter by the caller's user ID, it can return every user's rows (Supabase: Securing Edge Functions).

Why this matters

A function that anyone can call can be used to:

  • Run up your AI bill. A function that calls OpenAI or Anthropic with your key will happily do it for a stranger, over and over.
  • Send email or SMS from your account. Spam goes out with your name on it.
  • Read or change data. Functions often use the service role key, which skips RLS. One open function can undo all your table rules.
  • Fake a payment. A "mark user as paid" function with no check lets anyone upgrade themselves.

Step 1: List your functions (2 minutes)

You need two things: the names of your functions and how each one is set up.

  • In the Supabase dashboard, open Edge Functions to see the list.
  • If your project has a supabase/config.toml file, open it and look for lines like this:
[functions.send-email]
verify_jwt = false

Write down every function, and mark the ones with verify_jwt = false. Those are open to the whole internet unless the code checks the caller itself.

Some functions should have verify_jwt = false, like a Stripe webhook (Stripe has no user token). That's fine only if the function checks the Stripe signature. See our Stripe webhook guide.

Step 2: Call each function as a stranger (5 minutes)

Open a terminal. Replace the project and function names with yours.

Test A: no key at all

curl -i -X POST "https://YOUR-PROJECT.supabase.co/functions/v1/FUNCTION-NAME" \
  -H "Content-Type: application/json" -d '{}'
  • 401 Unauthorized: the platform check is on. Good start. Go to Test B.
  • Anything else (200, 400, 500, or real data): your code ran for a stranger. If this isn't a webhook that checks a signature, it's open.

Test B: only the public key

Your publishable or anon key is in your site's JavaScript, so assume everyone has it. Try:

curl -i -X POST "https://YOUR-PROJECT.supabase.co/functions/v1/FUNCTION-NAME" \
  -H "apikey: YOUR_PUBLISHABLE_OR_ANON_KEY" \
  -H "Authorization: Bearer YOUR_PUBLISHABLE_OR_ANON_KEY" \
  -H "Content-Type: application/json" -d '{}'
  • 401 or 403 with a message like "not logged in": your code checks the user.
  • The function does its job (sends an email, calls the AI, returns data): anyone can use it. Fix it.

Test C: two real users

If the function takes an ID (like {"orderId": 123}), log in as user B and ask for user A's item. If you get it back, the function checks that someone is logged in but not who. That's the same bug as in our two-account test guide.

Step 3: Watch out for these myths

  • "CORS protects it." No. CORS only tells browsers what to allow. curl, scripts and servers ignore it.
  • "Nobody knows the function name." Your app calls it from the browser, so the name is in your JavaScript and in the network tab.
  • "It's behind the login page." Hiding a button is not security. The URL still works without the page.

The fix

For a function that signed-in users call from your app:

  1. Keep verify_jwt on (it's the default). Don't turn it off just to clear a 401. Supabase calls this out as a common mistake (Supabase docs).
  2. Check the user inside the function. Read the user's token from the Authorization header and ask Supabase who it belongs to. Return 401 if there is no real user. Supabase's @supabase/server helper does this with auth: 'user' (Supabase: Securing Edge Functions).
  3. Use the user's own client for data. Then RLS still applies. Only use the service role key when you must, and filter every query by the caller's user ID.
  4. Check ownership. If the request names a record, confirm it belongs to the caller before you touch it.
  5. Rate limit costly work. AI calls, emails and SMS should have a per-user limit. See How to Stop Surprise OpenAI Bills.

For other kinds of functions:

Who calls itverify_jwtWhat the code must check
Your signed-in usersonA real user token, and that the user owns the data
Stripe, GitHub or another webhookoffThe provider's signature
A cron job or another serveroffA secret key (never the publishable key)
Truly public (health check)offNothing, but it must not touch private data or cost money

Prompt for your coding agent

Copy this into Lovable, Bolt, Cursor or Claude Code:

Please audit every Supabase Edge Function in this project for access control.

1. List each function, who is supposed to call it (signed-in user, webhook, cron/server, or public), and its verify_jwt setting in supabase/config.toml.
2. For functions called by signed-in users: keep verify_jwt on, and inside the function get the user from the Authorization header (supabase.auth.getUser or @supabase/server with auth: 'user'). Return 401 if there is no valid user. Do not treat the publishable/anon key as a logged-in user.
3. Use a Supabase client with the user's token so RLS applies. If a function must use the service role key, filter every query by the caller's user ID and check they own any record named in the request.
4. For webhooks (Stripe etc.): keep verify_jwt off, but verify the provider's signature and reject anything that fails.
5. For cron or server-to-server functions: require a secret key from server-side secrets, never the publishable key.
6. Add a per-user rate limit to functions that call AI providers, send email/SMS, or cost money.
7. Show me a table of each function with before/after, and give me curl commands to test each one with no key and with only the publishable key.

Do not turn off Row Level Security and do not expose the service role key to the browser.

Quick checklist

  • [ ] I have a list of every Edge Function and who should call it
  • [ ] Every function with verify_jwt = false is a webhook (checks a signature), a cron job (checks a secret key) or truly public
  • [ ] Calling each user function with only the publishable key gets a 401
  • [ ] User B can't get user A's data through any function
  • [ ] Functions using the service role key filter by the caller's user ID
  • [ ] AI, email and SMS functions have a per-user limit
  • [ ] I didn't rely on CORS or a hidden button for security

Related guides


Want a check on the public side of your app? VibeVigil looks for exposed keys, open Supabase tables, headers, SSL and uptime, and gives you a fix prompt for each issue. Run a free scan → (only scan apps you own)

Scan your app free. It checks the public page of a site you own. No account.

Can Anyone Call My Supabase Edge Function? How to Check and Lock It Down · VibeVigil