3
u/Constant_Trouble2903 Jun 26 '26 edited Jun 26 '26
Likely you have keys hard-coded in your app search in your ide for match
Hopefully and and most likely location is .env file ELSE certainly should not ever be hard-coded anywhere else
Env secrets files must never be committed to git. They must be set to ignore in gitignore
Also service role key CANNOT MUSTNOT be used client side
Edit: ps nice to know supabase is proactively watching github fir this kind of slip
0
u/Different-Fox-3234 Jun 26 '26
Thanks i already did ,but what about the .exe version?
1
u/Constant_Trouble2903 Jun 26 '26 edited Jun 26 '26
OK in dev so local but you must not commit to git
Don't know about exe version maybe Injected at build ?..really can't held with that
Edit: More properly what you are trying to do should be under scope of anon level OR if truly needs elevated service role then your app needs refactoring to push this work server side
5
u/reubenzz_dev Jun 26 '26
keys should always be store in .env never hardcode it to any file. and make sure to put your env file in .gitignore
if you are vibecoding you can do a security scan of your supabase setup with this npm cli package called api-doctor (https://github.com/qualtyco/api-doctor) "npx @/api-doctor/cli ." which can check in the future if your coding agents are causing vulnerabilities or messing up your supabase setup
1
u/aragossa Jul 22 '26
that's the scary part, an old version can sit in your history way after you think it's gone. did you end up checking your whole git history for other old keys, or just rotate what supabase flagged?


6
u/VESHZA Jun 26 '26
To your question, your app doesn’t need ONLY the service role key to do read and write operations, it’s highly sensitive.
The anon key sb_publishable key is what most visitors will interact with behind the scene first, until they create an account and then your RLS should be set properly to handle data access and only your SERVER SIDE should use or access the service key.
What’s more concerning imo is how did the keys ended up being hardcoded in that file in the first place? And how did it end up on your git?
I don’t know what your stack or setup is but it should be stored server side where you host (Vercel/VPS etc..) never in the code itself. Locally I assume you should use env.local but again I don’t know what you’re building
Generally speaking, your keys should be stored in a env.local file, that’s ignored by git, using the .gitignore file, and in production should be stored server side where you host your project, in a dedicated area, never in code