Skip to content

Secrets & keys

Server secret in a browser-exposed env variablesecrets.public-env-secret

Variables starting with NEXT_PUBLIC_, VITE_, REACT_APP_, EXPO_PUBLIC_ (and similar) are copied into the JavaScript every visitor downloads. A secret in one is public: anyone can open DevTools and read it.

  • In force Rule secrets.public-env-secret
  • 3 clauses

At a glance

secrets.public-env-secret
Severityhigh
CertaintyObserved — the code as written is the problem
Looks atyour source code
When it runsRuns on every scan

How to fix it

Rename the variable without the public prefix, read it only in server code (API routes, server actions), and rotate the value — it has already shipped to browsers.

Check your own app

Run npx scanlyfix scan in your project. Every finding gets an id; after fixing, npx scanlyfix verify <id> proves it is gone.

If it is a false positive in your project, silence that one line with // scanlyfix-ignore-next-line secrets.public-env-secret -- <why>.

All rules

Your code stays
on your machine

Only findings are uploaded, and only to your own dashboard.