Check provider logo

Vercel project has no secret-like environment variables exposed to the browser through a public prefix

project_environment_no_secrets_with_public_prefix

Severitycritical
Serviceproject
by Prowler

Vercel project environment variables are assessed for client-side secret exposure: variables whose names start with a framework public prefix (NEXT_PUBLIC_, VITE_, REACT_APP_, NUXT_PUBLIC_, PUBLIC_...) are inlined into the browser bundle, so any of them that ends with a secret-like suffix or is stored as sensitive leaks its value to every visitor.

Risk

A secret behind a public prefix is shipped in the JavaScript delivered to every visitor and can be read from the page source, CDN cache or browser devtools. A leaked service role key, API key or token gives anyone the same access the server has, enabling data exfiltration, privilege escalation and abuse of paid third-party services, with no authentication required.

Run this check with Prowler CLI

prowler vercel --checks project_environment_no_secrets_with_public_prefix

Recommendation

Reserve public prefixes for values that are safe to publish, such as a public site URL or an anonymous key designed for browsers.

  • Keep secrets in server-only variables marked as Sensitive
  • Rotate any secret that was ever exposed with a public prefix
  • Review bundles in CI for secret-like strings before deploying

Remediation

CLI

vercel env rm NEXT_PUBLIC_<SECRET_NAME> production && vercel env add <SECRET_NAME> production --sensitive

Terraform
Other
  1. Navigate to your Vercel project dashboard
  2. Go to Settings > Environment Variables
  3. Find variables whose name starts with NEXT_PUBLIC_, VITE_, REACT_APP_, NUXT_PUBLIC_ or PUBLIC_ and that hold keys, tokens, passwords or secrets
  4. Delete the public variable and rotate the credential
  5. Re-create it without the public prefix, marked as Sensitive, and read it only from server-side code (API routes, server components, server actions)

Source Code

Resource Type

NotDefined

References

Related To

  • project_environment_no_secrets_in_plain_type