Contact, if you are interested in this Development/Support/Sponsorship/Advertisement/Partnership
Security

Security for Vibe-Coded Apps: The Mistakes That Leak Data

The most common security failures in AI-generated apps — and exact fixes for authorisation, database policies, secrets, payments and rate limits.

AI-generated apps often look production-ready while hiding serious security gaps. The model optimises for “it works when I click it,” not “it is safe when someone malicious calls the API directly.” Here are the failures we see most, and how to fix each one.

1. Authorisation only in the UI

Hiding the “Delete” button from non-admins is not security. If the server or database accepts the request, anyone can send it. Fix: enforce every permission on the server and, where your database supports it, with row-level security policies. Test by calling the endpoint while logged in as a different user.

2. Missing or permissive database policies

Managed Postgres backends are often used directly from the browser. Without row-level security, a public key can read every row. Fix: enable RLS on every table, write explicit policies (“users read their own rows”), and keep service-role keys strictly on the server.

3. Secrets in front-end code

API keys for AI models, email or payment providers end up in client bundles more often than you'd think. Fix: move secrets to server-side environment variables, proxy calls through your backend, and rotate any key that was ever committed or shipped to the browser.

4. Guessable IDs and object access

URLs like /invoice/1042 invite people to try 1043. Fix: check ownership on every read and write; use non-sequential IDs as a second layer, never the only one.

5. Trusting the browser about payments

If the front end tells the database “this user is now Pro,” anyone can do the same. Fix: only a verified payment webhook updates plan status; feature gates read that status on the server.

6. Unvalidated input

Forms validated only in the browser can be bypassed. Fix: validate on the server with a schema, escape output to prevent XSS, use parameterised queries, and restrict file uploads by type and size.

7. No rate limits

Login, signup, password reset, contact forms and AI endpoints are abuse magnets, and AI endpoints cost you money per call. Fix: rate-limit per IP and per user, add a honeypot or CAPTCHA to public forms, and cap AI usage per plan.

8. No backups, logs or alerts

When something goes wrong you need to know, and you need to recover. Fix: daily backups with a tested restore, error monitoring, and alerts on spikes.

Run an audit in 10 minutes

Paste the “Security audit of AI-written code” prompt from our Prompt Library into your tool, then work through the Launch Checklist. If you handle payments or personal data and the results worry you, book an Express Rescue & Hardening review.

This guide is general information, not a substitute for a professional security assessment.

Express Build

Want this done for you?

Senior engineers, AI speed, fixed price. New builds or rescues of AI-built apps.

⚡ Get a free build quote