07 / GuidesThe last mile

10 min read · Facts checked November 29, 2026

Security basics for a vibe-coded app

Short answer

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.

45%

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, 2025

Veracode 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

TestHowA fail looks like
Two-account testLog in as user A, copy a record address, log in as user B, paste itUser B sees user A's record
Logged-out testOpen inner pages in a private windowPrivate pages load
Admin testAs a normal user, type admin page addressesAdmin screen opens
API testOpen the app's data address in a browserReal records returned to a stranger
Secret searchSearch the repository for the words key, secret, token, passwordReal values appear
Error testEnter bad input on a formA 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

  1. Veracode 2025 GenAI Code Security Report July 30, 2025
  2. OWASP Top 10 2025
  3. Supabase, Row Level Security
  4. Matt Palmer, CVE-2025-48757 disclosure May 29, 2025
  5. GitHub, About secret scanning
  6. Canadian Centre for Cyber Security, baseline controls v1.2 February 18, 2020
  7. Office of the Privacy Commissioner, breach basics
  8. IBM Canada, Cost of a Data Breach 2025 July 30, 2025

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.