- Home
- The 30 checks
- Your build copies a server secret into the app
Your build copies a server secret into the app
In plain English: Your build settings copy a secret key into the files every visitor downloads. Vite's define, Expo's extra and the env setting in next.config all paste values straight into the app, so a key that was safe on the server ends up public.
What happens if you ship it
The build writes the key into the JavaScript or app bundle that every visitor downloads, where anyone can read it and spend on your account.
How to fix it technical
Let your AI tool fix it
Paste this into Lovable, Bolt, Cursor, Replit or Claude Code:
Fix this problem in my project: Your build copies a server secret into the app. Remove this entry from the build config. Call the provider from a server route or edge function that holds the key, and have the app call that route instead. Change only what this fix needs, then tell me what you changed and anything I have to do myself.Check your app
Run npx sigship in your project folder. It reports this problem as bundle-config-secret, along with 29 other checks. Nothing leaves your computer. New to the terminal?
Questions
Why is the key public if it comes from an environment variable?
The build reads the variable on your computer and writes its value into the JavaScript, or the app bundle, that ships to users. Anyone can open that file and find the key.
How do Gemini and AI Studio apps get this wrong?
Some templates add GEMINI_API_KEY to Vite's define block so browser code can call Gemini. That puts the key in the bundle. Call Gemini from a small server route instead.
What can stay in the build config?
Values that are public by design, such as your app version, a Supabase anon key, a publishable Stripe key or a maps key restricted to your domain.