All guidesVercel and env vars
On this page

Vercel question

What are sensitive environment variables on Vercel?

By Ohad Krispin, founder of VibeRaven · LinkedIn

Short answer

A sensitive environment variable on Vercel is one whose value nobody can read back after it is saved: Vercel now calls this type Secret, next to Config for values that stay readable, and treats existing Sensitive variables as Secrets. The type does not keep the value out of the browser: a NEXT_PUBLIC_ or VITE_ variable is copied into the JavaScript bundle whatever its type.

Next step in your repo: run

npx -y viberaven@1.8.0 check
.

In a Vercel + Supabase app it reports a Supabase service role or secret key under NEXT_PUBLIC_ or VITE_ as service_role_key_in_client_env; it is advice, not a gate, and a repository check, not a live database test. It cannot read the Secret type or other secrets, so for those run git grep -nE "(NEXT_PUBLIC|VITE)_[A-Z0-9_]*(SECRET|PRIVATE|TOKEN)".

Or ask your coding agent to "run npx -y viberaven@1.8.0 check and fix what it reports".

Use this from your agent
  • Claude Code: 7 read-only tools; public repos only.
    claude mcp add --transport http viberaven https://viberaven.dev/mcp
  • Codex: same server, from the Codex CLI.
    codex mcp add viberaven --url https://viberaven.dev/mcp
  • In your repo: writes Vercel + Supabase check rules for your agent (what it writes).
    npx -y viberaven init
Paste this to your agent
Run `npx -y viberaven@1.8.0 check` in this Vercel + Supabase repo and review exposed-secret findings. Keep secrets out of NEXT_PUBLIC_ and VITE_ variables even when marked Secret in Vercel. Check the client bundle without printing values; report checks you could not run.

Open your app's repo in your coding agent, then paste this request.

Terminal output of a local next build: the NEXT_PUBLIC_PAYMENTS_KEY value is found as a string in a .next/static chunk, while the unprefixed PAYMENTS_SECRET value is in no browser file.
Terminal output of a local next build: the NEXT_PUBLIC_PAYMENTS_KEY value is found as a string in a .next/static chunk, while the unprefixed PAYMENTS_SECRET value is in no browser file.

How do I view a sensitive environment variable on Vercel?

You cannot, from the dashboard or the CLI. vercel env pull keeps the value already in your local file for a Secret, or writes a placeholder for you to replace. If nobody has the value, set a new one and rotate it at the provider.

Can a sensitive variable be used in Development?

Yes, now. Vercel says Secrets are allowed in Development, which reverses the earlier rule that limited Sensitive variables to Production and Preview.

Why can't I mark an integration's variable as sensitive?

Vercel does not let you change a variable an integration created to Secret from the list. Disconnect the resource from all its projects, rotate its secrets, reconnect it with Development deselected and Sensitive turned on, then redeploy. The Supabase integration is one example: Which env vars does the Supabase Vercel integration add?.

Store each Vercel variable as the right type

  1. 1
    For each variable, ask whether the value could sit on a public page. If it could, it may be Config with a public prefix. If not, it is a Secret with no prefix.
  2. 2
    Add secrets as Secret:
    Terminal
    vercel env add STRIPE_SECRET_KEY production --sensitive
  3. 3
    Rename any secret that has a NEXT_PUBLIC_ or VITE_ prefix, read it only in server code, and rotate it at the provider, because builds made with the prefix already shipped it.
  4. 4
    If you are a team owner and want production secrets kept apart, turn on Require Separate Values under Separate Production Secret Values in the team's Security settings.
  5. 5
    Redeploy after any change. A new value reaches new deployments only.

Secret or Config, and what reaches the browser

Two separate settings decide what happens to a value. The type decides who can read it back in Vercel. The name decides whether your build copies it into the browser.

Secret vs Config

Build logs redact a Secret value that is 32 characters or longer. To rotate a Secret, enter a new value. A saved Secret cannot become Config in place: delete it and create a Config variable.

How Vercel treats a Config and a Secret environment variable
QuestionConfigSecret
Readable after saving?Yes, by members with accessNo, it is write-only
What Vercel suggests it forNon-sensitive configuration, such as values with a public prefixPasswords, API keys and tokens
Vercel CLI defaultNames with a public framework prefixProduction and Preview
Copied into the browser under NEXT_PUBLIC_ or VITE_?YesYes

What a local next build put in the browser files

The prefix alone put the value in the chunk. On Vercel the result is the same whatever type the variable has.

Where two values ended up after a local next build, as in the image above
VariableFound in a .next/static browser file?
NEXT_PUBLIC_PAYMENTS_KEYYes, as a plain string in a chunk
PAYMENTS_SECRET (no prefix)No

Official docs behind this checklist

FAQ for builders before launch

What happened to the Enforce Sensitive Environment Variables policy?

Vercel deprecated it. Separate Production Secret Values replaces it: when on, every Secret needs a different value in Production than in the other environments.

Does the Secret type encrypt the value at build time?

The build still receives the plain value, which is how your code reads it. The type controls who can read it back after saving.