· 7 min read
Security Mistakes AI-Built Apps Ship With
AI-built apps often skip the security basics. Here are four common flaws and how to test for each before you ship.
AI-assisted development lets you move fast, but speed creates a specific risk: the security work that normally happens during code review, testing, and deployment gets skipped. The flaws that appear are not exotic. They are the same broken authorization, exposed credentials, and unsafe defaults that have always caused breaches, just shipped without the usual checks.
This guide covers four common security mistakes in AI-built apps and gives you a concrete test for each. If you want background on the broader stack, the vibe coding guide explains how the development model works.
Open API Routes
An AI-built backend may generate an endpoint that works correctly but has no authentication requirement. The frontend might show the right locked UI, but the underlying route accepts any request. File operations, administrative actions, and data exports are common victims.
How to test:
- Open the browser network panel and list every request your app makes. Also check your server code, API specification, and logs for routes the UI does not obviously call.
- Call each route with no session cookie or token, with an expired token, and with a deliberately malformed token. A protected route must return an authorization failure every time, not data, not a silent success.
- Try the same route with alternate HTTP methods (GET instead of POST, DELETE instead of PUT), trailing slashes, case variations, and direct calls that bypass the frontend entirely.
- Check error responses. A 500 with a stack trace can leak internal structure.
What to fix: Authorization must live in server-side middleware or route handlers. Hiding a button in the UI is not access control. Zapier's security review and Control Plane's production risk guide both emphasize this point.
If you use Supabase for your backend, verify your Row Level Security policies cover every table, not just the ones you thought to protect.
Secrets in the Browser
API keys, signing secrets, database credentials, and service tokens must never reach the browser. A value delivered in a JavaScript bundle, a source map, an HTML page, or a network request is effectively public. Anyone can read it with developer tools.
How to test:
- Build your app for production and inspect the output. Search the bundle files, source maps, and HTML for strings like
secret,token,password,private_key, and the key prefixes used by common providers. - Open a fresh incognito window, sign out, and watch every network request. Look for credentials passed as query parameters, headers, or response bodies.
- Check browser storage: localStorage, sessionStorage, and cookies. A session token in a cookie is expected; a database password is not.
- Search your repository history. A secret committed and then deleted still exists in git history.
What to fix: Move any privileged operation behind a server endpoint. Use server-only environment variables or a managed secret store. Revoke and rotate any credential that was exposed before you secured it, and scrub it from repository history if necessary. Abnormal AI's guide on vibe coding security risks covers this remediation path in detail.
Missing Access Checks
Authentication tells you who is signed in. Authorization tells you what they are allowed to do. AI-generated code commonly handles the first and skips the second. The result is that one user can read or modify another user's records by simply changing an ID in a request.
This is sometimes called insecure direct object reference, and it is one of the most common and damaging flaws in web applications regardless of how the code was written.
How to test:
- Create two accounts: User A and User B. Use User A to create a record and note its ID.
- Sign in as User B and make the same API request with User A's record ID. User B must receive an authorization failure. User B must not learn whether the record even exists.
- Repeat this for every sensitive operation: read, update, delete, download, export, invite, billing update, role change, and any administrative action.
- Try changing claims, role fields, tenant IDs, and any ownership value your app sends from the browser. The server must derive who owns what from its own database, not from a value the browser submitted.
A correct login flow does not prove authorization is safe. You must test per resource and per operation. Orca Security's vibe coding security glossary and the Canadian Centre for Cyber Security guidance both treat missing access checks as a primary risk in AI-generated apps.
If you are using Clerk or Auth0 for identity, remember that those tools handle authentication. You are still responsible for writing the authorization logic that checks whether the authenticated user may access the specific resource they requested.
Prices Trusted from the Client
If your app lets the browser submit the price, discount, quantity, or plan identifier and the server accepts that value without verification, a user can intercept the request and change it. This applies to one-time payments, subscriptions, credit grants, and any feature entitlement tied to a purchase.
How to test:
- Use a proxy tool or your browser's network panel with request editing to intercept a checkout request. Change the unit price, total amount, currency, quantity, product ID, and discount code. Submit the altered request and check whether the server charges the modified amount or grants access as though the original amount was paid.
- Also test: a quantity of zero, a negative quantity, an extremely large quantity, and a duplicate submission of the same checkout.
- Try buying a low-price product while submitting the identifier for a high-value entitlement.
- Test your payment webhook handler. Replay a webhook event from an earlier transaction and check whether the server processes it again.
What to fix: Recalculate price on the server from your own product and pricing records. Never trust a total or product ID from the browser for settlement. After a payment provider confirms success, verify on your server that the correct product, amount, currency, and user match your order record before granting access. A successful payment event alone does not prove your app credited the right thing.
If you use Stripe, verify webhook signatures and check the event's product and amount against your database before fulfilling the order.
Dependencies and Insecure Defaults
AI tools can add packages you did not deliberately choose, pick outdated libraries, or generate configuration with permissive defaults. Debug mode left on in production, overly broad CORS settings, and verbose error output that leaks stack traces are common examples.
How to test and review:
- Read your dependency manifest and lockfile. Verify each package exists in its registry, is the package you intended, is actively maintained, and is actually needed.
- Run software-composition analysis to scan for known vulnerabilities in your dependencies.
- Review default settings: database access policies, debug flags, network bindings, CORS origins, file access permissions, and rate limiting.
- Check that error responses in production return generic messages, not stack traces or database errors.
The Canadian Centre for Cyber Security recommends treating AI-generated code with the same controls as conventionally written code: human review, dependency scanning, secret scanning, static analysis, and least-privilege deployment.
A Pre-Release Test Sequence
Before you ship, work through these steps in order:
- Map every route and every trust boundary in your app.
- Scan source code, dependencies, and built artifacts for known vulnerabilities and secrets.
- Test each route unauthenticated and cross-account.
- Tamper with every client-controlled business value: prices, quantities, plan IDs, discounts.
- Test webhook handlers for replay and mismatch.
- Review all defaults: debug mode, CORS, error output, database policies.
- Turn every discovered flaw into a regression test so it cannot quietly reappear.
If you are building from a template, check the AppVibed template library to see whether the starting point already includes server-side authorization patterns, or start from scratch knowing you will need to add them. You can also find experienced builders who handle this work for hire.
Common Questions
Does using an authentication service like Clerk or Auth0 protect me from these flaws?
No. Authentication services verify identity. They do not write the authorization logic that checks whether a signed-in user may access a specific record or action. You must add that logic yourself, and you must test it per resource.
Can I test these things without a dedicated security tool?
Yes. A browser with developer tools, the ability to edit network requests, and two test accounts are enough to find the most critical flaws. For dependency scanning, free tools such as npm audit or pip-audit cover the basics.
Is AI-generated code inherently less secure than hand-written code?
The available research does not support a claim that AI-generated code introduces unique vulnerabilities. The risk is that familiar flaws ship without the review and testing steps that would normally catch them. The code needs the same controls as any other code.
What is the single highest-impact test I can run right now?
Create two accounts and try to access one user's records while signed in as the other. If that works, you have a serious authorization flaw regardless of everything else in your app.
My app does not take payments. Do I still need to worry about client-trusted values?
Yes. Any value the browser sends that your server uses to make a decision about access, quota, role, or privilege is a candidate for tampering. That includes free-tier limits, feature flags stored client-side, and self-reported plan levels.


