{"slug": "i-built-a-saas-with-lovable-in-one-prompt-then-audited-it-like-a-paying-client", "title": "I built a SaaS with Lovable in one prompt, then audited it like a paying client would", "summary": "A developer built a SaaS app with Lovable in a single prompt and then audited it using the same static review process applied to paying clients, finding that an initial automated pass scored the app 0/100 with six critical alerts that were all false positives, while the scanner missed two real issues. The genuine findings were uncapped AI spend on a reminder-email feature callable without per-user quotas, and a Stripe webhook that only downgrades on subscription deletion, letting failed-payment users keep Pro access. After manual verification the app scored 81/100 with zero critical and zero high findings.", "body_md": "Most \"AI-built apps are insecure\" posts are based on 2025 data: RLS switched off, service-role keys in the browser, unsigned Stripe webhooks. I wanted to know if that's still true, so I tested it.\n\n`/admin` page, and an AI button that drafts payment reminder emails.\nThen I ran the same static review I do for clients: scanners first (my own heuristics, semgrep, gitleaks, trufflehog, osv-scanner), then reading every flagged file and walking a 7-area checklist.\n\n`auth.uid()`. The invoice insert/update policies even check that the client row belongs to the same user.`plan` lives in a `subscriptions` table that users can only read; only the server-side webhook writes it.`user_roles` table with no insert policy for users, and the admin list is checked on the server.\nMy first automated pass scored the app **0/100 with six \"critical\" alerts. All six were false alarms.** Five came from a rule that expected `stripe.webhooks.constructEvent()` and didn't recognise a hand-written HMAC check, and it fired once per mention of \"stripe\". The sixth flagged a committed `.env` that only holds public values (Supabase URL and publishable key), which Lovable commits by default.\n\nMeanwhile, the scanner missed both real problems. A scan is a set of leads, not a verdict.\n\n**1. Uncapped AI spend (Medium).** The reminder feature is a `createServerFn` behind auth middleware, which is good. But any signed-in user can call it as often as they like, with no per-user quota. One script on a free account can drain your AI budget.\n\n``` js\nexport const draftReminder = createServerFn({ method: \"POST\" })\n  .middleware([requireSupabaseAuth])\n  .inputValidator(/* invoiceId */)\n  .handler(async ({ data, context }) => {\n    // ...loads the invoice, then calls the model. No quota check.\n  });\n```\n\nFix: an `ai_usage(user_id, day, count)` table, incremented in the same call, refusing over a limit (for example 20/day free, 200/day Pro), plus a spend alert.\n\n**2. Failed payments keep Pro (Medium).** The webhook upgrades on `checkout.session.completed` and downgrades only on `customer.subscription.deleted`. When a card fails, Stripe marks the subscription `past_due`/` unpaid` and retries for days or weeks before deleting it. The whole time the user keeps Pro for free, and your database says they're paying.\n\nFix: handle `customer.subscription.updated` and keep `plan = 'pro'` only while the status is `active` or `trialing`.\n\n**Smaller ones (Low):**\n\n`pg_advisory_xact_lock` fixes it).\n**Final score after manual verification: 81/100: 0 critical, 0 high, 3 medium, 7 low.**\n\nThe full, unedited report, with file names and line numbers, is here: [https://chinh-launch-audit.netlify.app/sample-report.html](https://chinh-launch-audit.netlify.app/sample-report.html)\n\nI do fixed-price launch-readiness reviews for AI-built apps. If you're about to launch something on Lovable, Bolt or Cursor and want a second pair of eyes, I'm doing a few free quick looks this week (read-only repo access, the 2 biggest risks by email, no call): [https://chinh-launch-audit.netlify.app/intake.html?plan=quick](https://chinh-launch-audit.netlify.app/intake.html?plan=quick)\n\n*I used AI tools (Claude) to help run the review and draft this post; every finding was verified by reading the code.*", "url": "https://wpnews.pro/news/i-built-a-saas-with-lovable-in-one-prompt-then-audited-it-like-a-paying-client", "canonical_source": "https://dev.to/quc_chnhinh_857c0b2af/i-built-a-saas-with-lovable-in-one-prompt-then-audited-it-like-a-paying-client-would-1k0k", "published_at": "2026-11-29 15:15:01+00:00", "updated_at": "2026-11-29 15:15:51.466468+00:00", "lang": "en", "topics": ["ai-tools", "ai-agents", "ai-products"], "entities": ["Lovable", "Stripe", "Supabase", "Bolt", "Cursor", "Claude"], "also_reported_by": [], "takeaway": "Automated security scans produced six false criticals on an AI-built app while missing an unquota'd server function and a webhook that only downgrades on subscription deletion, so verify findings by reading code and handle customer.subscription.updated to gate Pro access on active or trialing status", "recommendation": {"advice": "Treat scanner output as leads, not verdicts: manually verify each alert and add per-user quotas plus subscription-status checks before launching an AI-built app.", "playbook": "agent-security", "playbook_url": "https://wpnews.pro/playbooks/agent-security"}, "alternates": {"html": "https://wpnews.pro/news/i-built-a-saas-with-lovable-in-one-prompt-then-audited-it-like-a-paying-client", "markdown": "https://wpnews.pro/news/i-built-a-saas-with-lovable-in-one-prompt-then-audited-it-like-a-paying-client.md", "text": "https://wpnews.pro/news/i-built-a-saas-with-lovable-in-one-prompt-then-audited-it-like-a-paying-client.txt", "jsonld": "https://wpnews.pro/news/i-built-a-saas-with-lovable-in-one-prompt-then-audited-it-like-a-paying-client.jsonld"}}