Vercel vs Netlify: secrets, preview deployments and what each leaves public

Vercel and Netlify both store your environment variables safely and serve HTTPS. They differ on previews: Vercel's guide says Vercel Authentication is on by default for deployments other than production, while Netlify's docs say anyone with the link can open a Deploy Preview unless you add protection. On both, a variable with a public prefix ships to every visitor and every function is a public endpoint.

The team behind Keybrum's attacksUpdated 11 min read

In short

  • Neither host decides which of your variables are secret. A value behind NEXT_PUBLIC_, VITE_ or a similar prefix is copied into the JavaScript every visitor downloads.
  • Netlify Deploy Previews are open to anyone with the link unless you set up password or team login protection, which starts on the Pro plan.
  • Vercel Authentication is available on all plans and, according to Vercel's guide, enabled by default for deployments other than the latest production one. Password Protection costs $20 a month per project on Pro.
  • Netlify can fail a build when a value flagged as secret appears in the output. Vercel makes Secret variables write-only and redacts them from build logs.
  • A serverless function on either host is a URL on the internet. The host runs it for whoever calls it: the session and ownership checks are your code.
On this page

Vercel vs Netlify, through one lens

Most Vercel vs Netlify comparisons are about build minutes, pricing and Next.js support. This page looks at one thing: what each host leaves reachable in the app you deploy. Both are solid at their own job. They serve your site over HTTPS and run your builds and functions on infrastructure they maintain. What a stranger can read in your app depends on four things you configure: variables, previews, functions and headers.

VercelNetlify
Variable storageEncrypted at rest. Two types: Config (readable by authorized members) and Secret (write-only after saving)Variables per deploy context. A value flagged as secret becomes write-only and masked
Catching a leaked secretSecret values of 32 characters or more are redacted from build logsSecret scanning fails the build when a flagged value appears in code or output. Smart detection looks for unflagged secrets
Who can open a previewVercel Authentication on by default for non-production deployments, per Vercel's guide. Shareable links for outsidersAnyone with the link, unless password or team login protection is set up
Protection plansVercel Authentication on all plans. Password Protection: $20 a month per project on Pro, included on Enterprise, not on HobbyBasic password protection on Pro. Team login and previews-only options on Enterprise. Not on the Free and Personal credit-based plans
Builds from forksA Git Fork Protection setting in the project's security settingsUntrusted deploys need a team member's approval by default
Security headersYou add them, in vercel.json or your framework configYou add them, in _headers or netlify.toml, for static files only
From each vendor's documentation, read on 13 November 2026. Plans and prices change: check the linked pages.

Environment variables: which ones reach the browser

The rule is the same on both hosts, because the framework sets it. A variable is private until its name carries a public prefix. Then the build copies its value into the JavaScript bundle. Vercel's docs say Next.js inlines NEXT_PUBLIC_ variables into the client bundle at build time. Netlify's docs list REACT_APP_, GATSBY_, NEXT_PUBLIC_, NUXT_ENV_ and VUE_APP_ as examples and warn in plain words:

You should not copy sensitive values into your build as these values are accessible to anyone inspecting your app files in the browser.
Use environment variables with frameworks, Netlify Docs

Encryption at rest does not help here. The host protects the stored value. The prefix publishes it. This is the most common secret leak in generated apps: an agent that cannot read a key in the browser renames it NEXT_PUBLIC_OPENAI_API_KEY or VITE_STRIPE_SECRET_KEY, the error goes away, and the key is public. See API key exposed in the frontend.

  • On Vercel, choose Secret for passwords, API keys and tokens. A Secret cannot be read back after saving, by a team member or by someone who takes over an account. An optional team policy requires each Secret to use a different value in Production than in other environments. Changes apply to new deployments only, so redeploy after a rotation.
  • On Netlify, flag the value as Contains secret values. The flag cannot be removed, the value is masked in the UI, CLI and API, and the next build scans your code and output for it. If the value is found, the build fails and the deploy log gives the location. Scopes, on Pro and Enterprise, limit a variable to builds or to functions.
  • On both, give previews their own values. A preview that holds the production database password turns every preview bug into a production incident.

The April 2026 incident at Vercel shows why the type matters. Vercel's bulletin says an attacker who took over an employee's account was able to enumerate and decrypt non-sensitive environment variables, and it advises customers to store secrets as sensitive values so they cannot be read back. The Vercel security guide has the dated account.

Preview deployments: who can open them

Every branch and pull request gets its own URL on both hosts. A preview is often the least protected copy of your app: unfinished features, debug output, sometimes real data. Whether a stranger can open it is the biggest practical difference between the two.

On Vercel

Deployment Protection has a method and a scope. The method available on every plan is Vercel Authentication: a visitor must log in to Vercel and have access to the project. Vercel's guide to locking down deployments says it is enabled by default for all deployments, with the most recent production deployment excluded. The recommended scope, Standard Protection, covers every URL except your production domains. Outsiders get in through a shareable link, an approved access request, or an exception you add for one preview domain.

Check the doors you opened yourself. A Deployment Protection Exception makes a preview domain public. Protection Bypass for Automation creates a secret that opens every deployment of the project when sent as the x-vercel-protection-bypass header or query parameter. Treat that secret like a password: it belongs in your CI settings and nowhere else.

On Netlify

Netlify's docs state the default plainly: preview URLs for Deploy Previews or branch deploys can be shared with anyone with the link, unless you set up password protection or team login protection. The URL follows a fixed pattern, deploy-preview-42--yoursite.netlify.app for pull request 42, so the link is not hard to guess for someone who knows your site name. Netlify adds an X-Robots-Tag: noindex header to Deploy Previews, which keeps them out of search engines and does nothing against a direct visit.

Basic password protection for a whole site is on Pro plans. Team login protection and the option to protect only non-production deploys are on Enterprise plans, and the credit-based Pro plan offers a previews-only setting. Password protection is not available on the credit-based Free and Personal plans.

Serverless functions are public endpoints

An API route on Vercel or a function on Netlify is a URL. The host runs it for anyone who sends a request, on production and on any preview a visitor can reach. Netlify's docs note that functions are built and deployed with the rest of the site, Deploy Previews included. Neither host knows which caller is your user. Three checks belong in your code:

  • Who is calling. Read and verify the session in each function. A check in the page that calls the function protects nothing.
  • Whose record it is. Compare the record's owner with the caller before returning it. The IDOR guide has the pattern.
  • How often. A function that calls a paid AI model or sends email needs a limit. Vercel's firewall offers rate limiting rules. See unprotected AI endpoints.

Security headers: yours to add on both

Neither host writes your Content-Security-Policy. Vercel's production checklist asks you to implement a CSP and proper security headers yourself. On Netlify you declare them in a _headers file or in netlify.toml, with one limit to remember: custom headers apply only to files Netlify serves from its own store. A page rendered by a function, or content you proxy, must return its own headers.

json
{
  "headers": [
    {
      "source": "/(.*)",
      "headers": [
        { "key": "X-Content-Type-Options", "value": "nosniff" },
        { "key": "Referrer-Policy", "value": "strict-origin-when-cross-origin" },
        { "key": "Content-Security-Policy", "value": "frame-ancestors 'none'" }
      ]
    }
  ]
}
vercel.json. On Netlify, the same three lines go under /* in a _headers file. The security headers guide has the full set.

What to check on either host

  1. 1

    Open a preview while logged out

    Copy the URL of your latest preview and open it in a private window. If the app loads, it loads for anyone with the link. The first command below does the same from a terminal.

  2. 2

    List the variables that ship to the browser

    Search your code for public prefixes, as in the second command. Read each name. A name with SECRET, KEY, TOKEN or PASSWORD behind a public prefix needs a second look. A publishable key is fine. A secret key is a leak.

  3. 3

    Search the build output for secret formats

    Build locally and search the output folder for the formats of secret keys. Nothing should match.

  4. 4

    Set the type of every stored secret

    On Vercel, Secret. On Netlify, flagged as containing secret values. Then rotate anything that was stored as a readable value and is sensitive.

  5. 5

    Call your functions with no session

    For each API route or function, send the request without a cookie or token. Anything that returns private data or performs an action is open.

  6. 6

    Read your headers

    Check which security headers your production URL returns, on a static page and on a server-rendered one.

bash
# 1. Is the preview public? 200 means yes. 401 or a redirect to a login means protected.
curl -s -o /dev/null -w "%{http_code}\n" "https://YOUR-PREVIEW-URL"

# 2. Variables that the build publishes
grep -rhoE "(NEXT_PUBLIC|VITE|REACT_APP|GATSBY|VUE_APP|NUXT_ENV)_[A-Z0-9_]+" src app pages 2>/dev/null | sort -u

# 3. Secret formats in the built files (.next/static, dist or build)
grep -rlE "sk_live_|sk-proj-|sb_secret_|service_role|BEGIN (RSA |EC )?PRIVATE KEY" .next/static dist build 2>/dev/null

# 4. Headers of your own production URL
curl -sI "https://YOUR-APP" | grep -iE "content-security-policy|strict-transport|x-content-type|referrer-policy|x-frame"
Run these on your own project and your own URLs.

Which one should you choose?

On this lens alone, each has an edge. Vercel's is previews: protection by login is on every plan and on by default according to its own guide, and the firewall with custom rules is available on all plans. If your team opens many pull requests on a Next.js app, that default matters. Netlify's is build-time secret scanning: failing a build that contains a flagged secret, and detecting likely secrets nobody flagged, stops a class of leak before it is live. Its default approval for untrusted deploys is also a careful choice.

Their weak spots mirror that. On Netlify, previews are public by link until you pay for protection and turn it on. On Vercel, a variable saved as Config stays readable to team members whose role gives access to the project's variables, so the type has to be chosen with care. Pick the host that fits your framework and your budget, then close the gap it leaves.

What Keybrum tests on apps hosted on either, and what it does not

Keybrum is the automated pentest we build for apps made with AI. It attacks a deployed address from outside, once its owner has proved ownership. On an app hosted on Vercel or Netlify, that covers:

  • Secrets in what the browser downloads: keys of many providers in the JavaScript, the HTML and readable files, each checked with a read-only call to see whether it works.
  • Files that should not be served: .env files, source maps, a .git folder, backups.
  • Functions and API routes: every route your JavaScript calls, requested with no session, then across two accounts.
  • Headers: the baseline of browser security headers on each origin you own.
  • Forgotten DNS: subdomains that still point at a deleted Vercel or Netlify site that someone else could claim.

On paid plans, connecting Vercel, Netlify or GitHub lets Keybrum attack each deploy, previews included, before it ships: a CI check can stop the merge when a deploy brings a new finding. A preview is attacked only when it carries your app's verification tag or file, which previews built from the same code do. The Team plan (€99 a month excluding VAT, 25 apps) also finds every app deployed on your Vercel, Netlify or Supabase accounts, including the ones nobody declared. Maker is €29 a month for 5 apps, and a one-time report on one app is €49.

It does not audit your host's settings: team roles, variable types and protection options are for you to read in the dashboard. It tests what an address answers. And it never runs denial-of-service traffic against your host.

Questions

Is Vercel more secure than Netlify?

Both protect their own platform well, and neither protects the logic of your app. Vercel protects previews by login on every plan. Netlify scans builds for flagged secrets. The leaks we see on both come from public-prefixed variables and functions with no auth check.

Are Netlify Deploy Previews public?

By default, yes for anyone who has the link. Netlify's docs say preview URLs can be shared with anyone unless you set up password protection or team login protection. Search engines are told not to index them, but that does not block a visit.

Are Vercel preview deployments public?

Not when Vercel Authentication is on, which Vercel's guide describes as the default for deployments other than the latest production one. Check your project's Deployment Protection settings, and review any exception, shareable link or automation bypass secret you created.

Are environment variables on Vercel and Netlify safe?

Stored values are encrypted, and both hosts offer a write-only type for secrets. A variable whose name starts with a public prefix such as NEXT_PUBLIC_ or VITE_ is copied into the browser bundle by your framework, whatever the host does.

Do Vercel or Netlify add security headers for me?

Not the ones that depend on your app, such as a Content-Security-Policy. You add them in vercel.json or your framework config on Vercel, and in _headers or netlify.toml on Netlify. On Netlify, pages rendered by functions must set their own.

Can a stranger call my serverless functions directly?

Yes. A function is a public URL on both hosts. Hiding the button that calls it does not hide the function. Check the session and the record's owner inside the function, and add a rate limit on anything that costs money.

Sources

  1. 1.Deployment Protection on Vercel, Vercel Docs
  2. 2.How to lock down deployments on Vercel and v0, Vercel
  3. 3.Bypass Deployment Protection for testing, sharing, and automation, Vercel Docs
  4. 4.Config and Secret environment variables, Vercel Docs
  5. 5.Environment variables, Vercel Docs
  6. 6.Deploy overview, Netlify Docs
  7. 7.Password protection, Netlify Docs
  8. 8.Secrets Controller, Netlify Docs
  9. 9.Use environment variables with frameworks, Netlify Docs
  10. 10.Custom headers, Netlify Docs
  11. 11.Vercel April 2026 security incident, Vercel

Your app is public. So are its mistakes.

Check what any attacker can already see in it, free, in ten seconds. The full attack, with proof and fixes: €49 once, or €29 a month on a plan.

or continue with Google or GitHub