4 Common Security Mistakes in AI-Generated 'Vibe-Coded' Apps

Many creators using AI to build apps are skipping fundamental security steps. A study of these vibe-coded projects found widespread vulnerabilities to hacking and high server costs.

Tools like Cursor and Lovable allow anyone to build apps by describing their vibe, but this often leads to a false sense of completion. Research showed that many such apps leave sensitive API keys exposed in the frontend, where anyone can steal them. They also lacked rate limiting, making them targets for bots that can quickly drain expensive AI credits. Many sites failed to use middleware to protect private pages, allowing access via direct URLs. Additionally, hardcoding secrets instead of using environment variables made apps unscalable and insecure. AI helps you build fast, but validating security remains the human operator's job.

Key points

  • Never store sensitive API keys in frontend code visible to users.
  • Add rate limiting to stop bots from crashing your site or raising bills.
  • Use middleware to ensure only authorized users can access specific routes.
  • Store all secrets in environment variables instead of writing them in code.

Quick term guide

vibe-coded
Code made quickly with heavy AI help, often without fully understanding every part.
vulnerabilities
Weaknesses in a computer system that hackers can exploit.
API keys
Secret codes that let one app or service access another service.
API key
A private code that lets a service know which account is using it.
rate limiting
A security measure that limits how often a user can access a site.
rate limit
A cap on how many times or how much you can use an AI model within a set time window.
credits
Units Replit charges when you use its AI features; you buy more when they run out.
middleware
A security layer that checks user permissions before loading a page.

Sources covering this story (2)

Read original