secret_in_client_bundle
Severity: warn, labelled Probably real. A secret key may be in code the browser downloads. The deploy goes on; Kaviris never blocks a deploy for a secret.
What Kaviris saw
A secret (a key that must stay private) is in a file that visitors' browsers
download, such as anything under public/, static/, dist/, build/ or
.next/static/, or in an environment variable whose name makes the build
put it into browser code: VITE_…, NEXT_PUBLIC_…, PUBLIC_…,
REACT_APP_…, EXPO_PUBLIC_….
Why it matters
Everything the browser downloads, anyone can read: open the page, view the source, and the key is there. With a Stripe secret key someone can issue refunds; with a Supabase service-role key they can read and delete your whole database.
How to fix it
-
Move the call that needs the key to your server code (an API route, a server action, an edge of your backend). The browser calls your server; your server holds the key.
-
Rename the variable without the browser prefix, for example
VITE_STRIPE_SECRET_KEYbecomesSTRIPE_SECRET_KEY, and read it only in server code. -
Declare it and set it by reference. The warning's
fixhas the commands:kaviris secrets set STRIPE_SECRET_KEY --from-env STRIPE_SECRET_KEY --declare -
Rotate the key with the provider. It has been public.
-
Deploy again.
Agents: apply fix.patch with update_contract, approve_contract, then
set_secret without a value, and change the code as fix.summary says.
Keys that are meant to be public (Supabase anon or sb_publishable_…,
Stripe pk_…) only get a note; see publishable_key.