Security basics for a vibe-coded app
Most security damage in AI-built apps comes from a few repeatable flaws: weak access rules, exposed keys, no logging and unpatched libraries. You can test the first two yourself in an hour. Veracode found security flaws in 45% of its AI coding tasks, so treat unreviewed AI code as unfinished.
The short version
AI tools are good at making software that works when used as intended. Security is about what happens when someone uses it in a way you did not intend. That is hard to see by clicking around, and the model has no stake in whether you notice.
of Veracode's 80 coding tasks yielded code with a flaw from the OWASP Top 10 class. Java failed over 70%. Python, C# and JavaScript failed 38% to 45%.
Veracode, July 30, 2025Veracode also reported cross-site scripting failing in 86% of relevant cases and log injection in 88%, and that larger models were not significantly better. This is a vendor study of code completion, not of finished products. It tells you what to test, not how bad your app is.
The five flaws to look for
1. Broken access control
One user can reach another's data, or a normal user can reach admin features. It is first on the OWASP Top 10 2025. In 2025 a security researcher disclosed CVE-2025-48757: Lovable-built projects with missing or insufficient row level security policies could expose database tables. The write-up is dated May 29, 2025, and the researcher reported it to the vendor on March 21. See Matt Palmer's disclosure. We did not quote the NVD record, which would not load for us.
Supabase's own documentation is clear on the mechanism: a table in an exposed schema without RLS is readable and writable by any role with a grant on it, and with RLS on but no policies, nothing is reachable through the API with a publishable key. Each operation (read, insert, update, delete) needs a policy. See Supabase RLS.
2. Secrets in the wrong place
API keys, database passwords and tokens in the code, in the browser, or pasted into a chat with the AI. GitHub's secret scanning looks for credentials across the whole git history, which matters because deleting a key from the latest version does not remove it from the past. Rotate any key that has ever been exposed.
3. Security misconfiguration
Default settings left on, debug pages open, storage buckets public. OWASP ranks it second.
4. Outdated or untrusted libraries
Apps built from many packages inherit their flaws. OWASP now lists Software Supply Chain Failures third. Ask who updates dependencies and how often.
5. No logging or alerts
Without logs you cannot tell if you were breached, or what was taken. OWASP lists Security Logging and Alerting Failures ninth.
Tests you can run in an hour
| Test | How | A fail looks like |
|---|---|---|
| Two-account test | Log in as user A, copy a record address, log in as user B, paste it | User B sees user A's record |
| Logged-out test | Open inner pages in a private window | Private pages load |
| Admin test | As a normal user, type admin page addresses | Admin screen opens |
| API test | Open the app's data address in a browser | Real records returned to a stranger |
| Secret search | Search the repository for the words key, secret, token, password | Real values appear |
| Error test | Enter bad input on a form | A stack trace or a database name appears |
Practical controls for a small business
The Canadian Centre for Cyber Security publishes 13 baseline controls for small and medium organizations. The ones that map most directly onto a small app are: strong user authentication, access control and authorization, backing up and encrypting data, patching, securing websites, securing cloud and outsourced IT, and having an incident response plan. The document is dated February 2020 and says its information remains valid. See the Centre's guidance.
What AI tools should and should not touch
- Never paste live secrets into an AI chat.
- Never give an AI agent write access to production data without a separate backup and a clear rule it cannot change.
- Treat each AI-suggested library as untrusted until someone checks it exists, is maintained and is the one you meant.
When a breach happens anyway
If personal information was involved, Canadian federal privacy guidance says to report a breach of security safeguards to the Privacy Commissioner and notify affected people when there is a real risk of significant harm. Organizations must also keep a record of every breach of safeguards for 24 months, whether or not it reached that threshold. Provincial rules can differ; BC has its own law. See privacy in Canada.
Cost context: IBM Canada reported on July 30, 2025 that organizations in Canada paid an average of CA$6.98 million per breach in 2025, up 10.4% from CA$6.32 million in 2024. That is an average across mostly large organizations, so it overstates what a small app faces. See IBM Canada.
Next steps
Run the tests above. Then use the production checklist, and get an outside reader for anything holding customer data. See who can review my app.
Common questions
Is AI-generated code less secure than human code?
We found no head-to-head study we could verify. We found evidence that AI-generated code often contains common flaws (Veracode's 45%). A reviewed codebase from either source is safer than an unreviewed one.
What is row level security?
A database feature that decides which rows each user may read or change. If it is off, or has no policies, the database may answer anyone who holds the public key.
Is it safe to put an API key in the front end?
Only keys designed to be public, and only with access rules behind them. Any secret key in browser code can be read by anyone.
Do I need cyber insurance?
We cannot advise on that. Ask an insurance broker, and ask whether the policy expects specific controls.
Sources
- Veracode 2025 GenAI Code Security Report July 30, 2025
- OWASP Top 10 2025
- Supabase, Row Level Security
- Matt Palmer, CVE-2025-48757 disclosure May 29, 2025
- GitHub, About secret scanning
- Canadian Centre for Cyber Security, baseline controls v1.2 February 18, 2020
- Office of the Privacy Commissioner, breach basics
- IBM Canada, Cost of a Data Breach 2025 July 30, 2025
Keep reading
- Vibe-coded app production checklist: 15 checks before launch
- Who can review my vibe-coded app, and what should they hand back?
- Privacy and your vibe-coded app in Canada
Written by the VibeRamp editors. Drafted with AI assistance from the primary sources listed above, and each figure was checked against its page on November 29, 2026. It has not been reviewed by a lawyer, accountant or security professional, and it is general information, not advice. Things we could not confirm are marked as such in the text.