Vibe coding security
AI coding tools aim at what a person sees while trying the app, so the protections that work out of sight are often missing. The same weaknesses come back from one app to the next, and each one on this page has a known way to close it.
Risks
The usual weaknesses, one by one
The list covers well-known classes of weakness, drawn from how the tools work, and any single app may have more of them or fewer.
| Weakness | What can go wrong | What closes it |
|---|---|---|
| In the browser | ||
| Secret keys in the page | A key for a paid service such as OpenAI or Stripe that ships with the page can be copied by any visitor, who then runs up charges on your account. | Calls to paid services go through the server, which holds the key, and any key that was ever exposed is replaced with a new one. |
| Admin checks in the browser | When only the page hides the admin area, anyone who types its address or asks for its data directly can get in. | The server checks the role of the account on every request for admin data, whatever the page shows. |
| Prices set by the page | If the page tells the server what to charge or when a feature is paid for, a user can change the amount or skip the payment. | Prices live on the server, and paid features open only after the payment provider confirms the payment to the server. |
| On the server | ||
| Weak sign-in and sessions | Reset links that never expire, sessions that stay open for months and admin accounts guarded by a password alone make accounts easy to take over. | Each reset link works once and then expires, sessions end after a set time, and admin accounts sign in with a second factor. |
| Unchecked input | Text from a form that reaches the database or the page unchanged leaves room for injection, where the input gets run as code. | The server validates every field, queries pass values as parameters, and the page escapes whatever it shows. |
| No limits on use | A single script can create thousands of accounts or AI requests, and the bill from the AI service lands on your account. | Sign-up, sign-in and AI calls get rate limits per account and per address, and the AI provider gets a spending cap. |
| In the database | ||
| Open tables | Without access rules the database answers any signed-in user, sometimes anyone at all, so one request can download every customer record. | Every table gets rules on who reads and writes which rows, such as row level security in Supabase or security rules in Firebase, tried from each role. |
| No restored backup | An app whose copies have never been restored can lose its customer data for good to one wrong command or one failed update. | Daily copies are kept away from the main server, and a restore is run once to prove that they work. |
| Around the code | ||
| Old or invented packages | Outdated libraries carry published holes, and a model can name a package that does not exist, which someone can later register with harmful code. | Packages are updated, checked against known advisories and confirmed to be the intended ones before they are installed. |
| No tests on key flows | A new request to the AI tool can break sign-up or payment without anyone noticing, until a customer runs into it. | Automated tests on sign-up, sign-in and payment run before each release and hold back a change that breaks them. |
| Errors nobody sees | With no logs and no alerts, failed payments, crashes and attacks stay unseen until users complain. | The server logs its errors and sends an alert to someone who is there to act on it. |
| Personal data without a policy | An app that stores names, emails or payments falls under data-protection law, such as the GDPR in the EU or the Swiss Federal Act on Data Protection, and both oblige it to tell users what it collects and why. | Visitors find a privacy policy that matches what the app collects, and analytics or advertising wait for consent where the law asks for it. |
Self-check
Four checks to run on your own app
None of them needs any code, and each one takes a few minutes in a browser or in the database console.
Secret keys in the pageBrowser
- Try
- Open the app, open the developer tools of the browser and search the loaded files for the words secret and service_role, and for keys that start with sk.
- Expected
- Only keys marked publishable or anon turn up, since those are made to be seen by the browser.
- If not
- A secret key that reached the page has to move to the server and be replaced, because someone may already hold a copy.
Records of another accountData
- Try
- Create two accounts, note the address of a record that belongs to the first, then sign in as the second and open that address.
- Expected
- The app refuses or shows an empty page, because the record belongs to someone else.
- If not
- Missing or wrong database rules leave the data of every user open to every other account.
The admin area, signed outAccess
- Try
- In a private window, type the address of an admin page directly, then sign in as an ordinary user and try once more.
- Expected
- Both attempts end on a sign-in page or a refusal, with no admin data in the network tab of the browser.
- If not
- The admin area is guarded only by the page, and its checks have to move to the server.
The warnings of the databaseRules
- Try
- In Supabase, open the Security Advisor of the project, and in Firebase, read the security rules of the database and of storage.
- Expected
- Every table has row level security switched on, and no Firebase rule lets everyone read and write.
- If not
- Tables without rules can be read with the public key that ships with every page of the app.
Run these only on an app you own or have written permission to test, since trying them on anyone else's app can break the law.
Help
Have a developer check your app
The first step is a free call of 30 minutes online, and the review that can follow lists every finding with one price for all the fixes.