Unsecured Staging and Preview Copies: Lock Down Preview Deployments and Supabase Branches

Vercel and Netlify previews and Supabase branches are real, reachable copies of your app. How to check whether yours are open, using production keys, or holding real data, and how to lock them down.

Updated 2026-11-25

Your test copy is still on the internet

Hosts like Vercel and Netlify build a preview of your app for a branch or pull request and give it its own web address. Vercel gives every deployment a generated URL, plus a branch URL that always points at the latest commit on that branch. Netlify serves a pull request preview at an address like deploy-preview-42--mysitename.netlify.app, and every deploy also gets a permalink whose contents never change.

Supabase works the same way for the database. Each branch is a separate environment with its own Supabase instance and its own API credentials, and persistent branches meant for staging or QA are not deleted when a pull request closes.

Whether a stranger can open one of these copies depends on settings you choose. A preview that nobody meant to share can still be reachable by anyone who has, guesses, or finds the link.

Three ways a staging copy leaks

  • The preview is open to anyone. On Vercel, Deployment Protection is set per project, and a team default can be All Deployments, Standard Protection, or None. If it is None, preview URLs are public. On Netlify, previews follow your project visibility or Password Protection settings, depending on your plan.
  • The preview uses production keys. Netlify's docs say that by default an environment variable has the same value for every deploy context, so a Deploy Preview gets your production secret unless you set a separate value. On Vercel you choose which environments each variable applies to, and Vercel's docs warn that staged production deployments use production environment variables, so testing can reach production services and data.
  • The staging database holds real data without the same rules. Supabase branches start with no data by default, but if you turn on Include data, the branch holds a copy of your production data and Supabase says to treat it with the same care as production. A branch's schema is built from migrations, so row level security you switched on by clicking in the dashboard, and never saved as a migration, may be missing there.

Check your own setup in 15 minutes

Do these for every project that has previews or a staging copy:

  • Vercel: open the project's Settings, then Deployment Protection. Confirm Standard Protection (or All Deployments) is on with Vercel Authentication.
  • Open a preview URL in a private browser window. You should get a Vercel login, not your app. The curl command below should show a redirect to vercel.com/sso-api.
  • Netlify: check the project's visitor access settings. Previews should be private or password protected unless you mean to share them.
  • List your environment variables and the environments or deploy contexts each one applies to. Any live secret key (Stripe sk_live_, a Supabase service_role key, an OpenAI key) that also applies to Preview or Deploy Previews needs a separate test value.
  • Supabase: open the Branches page. For each branch, find out whether it was created with Include data, then run the Security Advisor and the same row level security check you run on production.
  • Delete previews, permalinks, and branches you no longer need. Each one is another copy to protect.
# Replace with one of your preview URLs
curl -sI https://my-app-git-feature-myteam.vercel.app | head -5

# Protected: a 302 or 307 with a location header pointing to vercel.com/sso-api
# Open: HTTP 200 and your app's page

Lock it down

Turn on protection first, then separate the keys and the data. Vercel lists Standard Protection with Vercel Authentication as available on all plans; Password Protection is a paid add-on there.

  • Protect previews: Vercel Standard Protection with Vercel Authentication, or Netlify private previews or Password Protection for non-production deploys.
  • Give previews their own keys: set Preview (Vercel) or Deploy Previews and Branch deploys (Netlify) values that point at test accounts and a staging Supabase branch, never at production secrets.
  • Keep real data out: seed branches with fake data. If you must use Include data, protect that branch like production and delete it when you are done.
  • Save database security in migrations: if you changed tables or policies in the Supabase dashboard, pull those changes into a migration so every branch gets the same row level security.
  • Remember that on Vercel, changing an environment variable only applies to new deployments. Old previews keep the old value until you redeploy or delete them.
  • If a production secret was ever in a preview anyone could open, treat it as leaked: rotate it first, then check the provider's usage logs.
# Capture schema and policy changes made in the Supabase dashboard
supabase db pull --remote

A prompt you can paste into your coding agent

Paste this into Cursor, Lovable, or Claude, then check every change it suggests:

Review how this project uses environment variables across production, preview, and local development. List every secret it reads (do not print the values) and tell me which environment each one should come from. Make sure preview and staging builds read test or staging keys and a staging database, never production secrets. Make sure every table's row level security and policies are defined in migration files, not only in the dashboard, so preview branches get the same rules. List anything that still points preview builds at production.

Quick answers

Are Vercel preview deployments public?

It depends on your project's Deployment Protection setting. Standard Protection, available on all plans, protects every deployment except your production domains. If protection is set to None, anyone with a preview URL can open it. Open one in a private window to check.

Does a Supabase branch copy my production data?

Not by default. New branches start without production data or storage objects. If you turn on Include data when creating a branch from the dashboard, it holds a copy of production data and should be protected like production.

Do Netlify Deploy Previews get my production secrets?

By default a Netlify environment variable has the same value in every deploy context, so yes, unless you set a different value for Deploy Previews and branch deploys.

Can Freedom Check scan my staging or preview URL?

Yes, if the URL is public and you own it. The scan checks that one URL the same way it checks production. If the URL sends us to a Vercel login, the scan stops and tells you it is protected. It cannot list your previews or branches or read your environment variable settings.

Sources

Check your live app for free

Freedom Check scans one public URL at a time. Paste a preview or staging URL you own and it runs the same read-only checks as on production: secret key patterns in the page, up to 8 same-site scripts, and public source maps; /.env, /.env.local, /.git/config, and /.git/HEAD; security headers; and a logged-out read of one row from up to two Supabase tables the code names. If the URL sends us to a Vercel login, the scan stops and tells you it is protected. It cannot list your preview deployments or Supabase branches, read your environment variable settings, or see data in a database your page does not use.

The free scan shows how many issues turned up and explains the most serious one with a fix prompt. The full report is $19 one time, or $29/month for unlimited.

Run a free scan →See pricing