PeekLok

API keys in front-end code

Anything in your front-end code is downloaded by every visitor. Keys for OpenAI, Stripe secret keys, email services and similar must live on a server.

Free scan: check my app Just your web address. Results in seconds. No signup, no card.

What can go wrong

Someone copies your key and runs up your bill, sends email as you, or reads your payment data.

How to check

  1. On your live site press F12 and search the loaded files for “sk-”, “sk_live”, “key” and “secret”.
  2. Check any variable starting with VITE_, NEXT_PUBLIC_ or REACT_APP_. These are public by design.
  3. Rotate any secret you find, then move it.

What PeekLok’s scan checks

PeekLok’s scan searches your page and the scripts it loads from your own site for common secret key formats: OpenAI, Anthropic, Stripe live secret, AWS, GitHub and Google API keys, plus private key blocks. It can’t recognise every kind of key, so still do the check above.

General fix prompt

Find every secret API key used in front-end code, including any VITE_, NEXT_PUBLIC_ or REACT_APP_ variable that holds a secret. Move each call that needs a secret into a server function, store the key as a server secret, and have the front end call that function instead. List the keys I must rotate.

Builder-specific guides

Sources

Get a free scan

PeekLok checks your live app for secret keys in the page code, a Supabase service or anon key showing, Supabase tables anyone can read with the public key, and five browser security headers. If your app uses Supabase login, you can add two test logins and it checks whether one user can see the other’s data. Only scan apps you own. First scan free. Weekly re-checks will be $12 US a month once payments open.

Start my free scan