Skip to main content
Secure What You Shipped

9 Security Mistakes AI Puts in Your Code (and How to Spot Them)

AI coding tools reliably introduce the same handful of security weaknesses; here is how to recognize the warning signs of each one without writing a single exploit.

You shipped something real with an AI coding tool. It works, people use it, and now a quiet worry has moved in: you have heard that AI-written code can be loose on security, but you cannot tell which specific problems live in your app or how you would even recognize them.

This is a field guide to nine security weaknesses that AI coding tools tend to reproduce. For each one you get three things: what it is in plain English, the tell-tale sign you can look for in your own project, and the safe direction to fix it. There are no attack recipes here, and nothing you can copy and paste to break an app. The goal is detection first: learn to spot the warning signs so you know what to fix yourself and what to hand to a professional.

If you want the wider walkthrough that these mistakes plug into, keep the full non-engineer security self-audit open in a second tab. This post is the close-up on the recurring weaknesses.

Why AI tools repeat the same security mistakes

AI coding assistants are pattern machines. They predict the code that most commonly follows your prompt, and the most common code on the public internet is not always the most secure code. Tutorials cut corners to stay short. Sample projects hardcode values to keep things simple. Old answers linger for years after the safe approach changed. The model absorbs all of it and hands you the average, not the audited best.

Two other habits make it worse. AI tools optimize for "make it run," so they reach for whatever gets past the error fastest, and security controls are exactly the kind of friction that gets skipped when the goal is a working demo. And they have no memory of your specific app: they do not know which of your routes touch money, which handle personal data, or which are exposed to the public, so they apply the same generic scaffolding everywhere.

Research has repeatedly found that a meaningful share of AI-generated code contains security weaknesses, with some studies putting it at roughly a third or more of samples. Treat any specific percentage you see quoted, including that one, as something to verify against the actual study rather than a settled fact. The point that survives scrutiny is simpler: these tools produce insecure patterns often enough that checking is not paranoia, it is basic maintenance.

The good news is that the mistakes cluster. Once you can recognize the nine below, you have covered most of what shows up in solo, AI-built apps.

Mistakes 1 to 3: secrets, input handling, and data access

1. Exposed secrets and API keys

What it is: A secret is a private credential, like an API key, database password, or payment provider token. Exposed means it is written directly into your code or shipped to the user's browser instead of being kept on the server and loaded from a protected location.

The sign you can spot: Search your project for your key values. Open your code and look for long random-looking strings sitting inside quotes, especially anything labeled key, secret, token, or password. Check whether any of those appear in files that run in the browser (front-end code) rather than only on the server. Also look at your version history: if a key was ever committed, it is in the history even after you delete it.

The safe direction: Secrets belong in environment variables or your host's secrets manager, loaded at runtime, never pasted into front-end code or committed to your repository. If you find a key that was exposed, treat it as compromised and rotate it, meaning generate a new one and retire the old, because you cannot know who saw it. This is common enough that it has its own deep dive on hardcoded secrets and keys you must rotate. Rotating a live payment or database credential can break your app if done carelessly, so if that key is in production, coordinate the swap rather than deleting first and hoping.

2. Missing input validation

What it is: Input validation means checking that data coming from a user matches what you expect before you use it, such as confirming an email field actually looks like an email or that a quantity is a positive number.

The sign you can spot: Look at the code that handles a form submission or an API request. Does it take the incoming values and use them straight away, or is there a visible check first? A tell-tale sign is that your app accepts obviously wrong input without complaint: paste a huge block of text into a field meant for a name, submit a negative number where only positives make sense, or leave a required field blank. If the app quietly accepts it, validation is probably thin or absent.

The safe direction: Every value that comes from outside your app should be checked against clear rules for type, length, format, and range before it is stored or acted on. Ask your AI tool to "add server-side validation for this endpoint" and be specific about the rules. The important phrase is server-side: front-end checks improve the experience but can be bypassed, so the real validation has to happen on the server.

3. Over-permissive data access

What it is: This is when your app can read or change more data than it should. A common version in no-code and AI-built apps is a database where the default rules let any request read the whole table, so one user can pull another user's records.

The sign you can spot: If you use a hosted database or backend (the kind where you configure access rules in a dashboard), open those rules and read them. Wide-open settings often literally say things like "allow all" or leave the read and write rules blank. Another sign: log in as one test user, note a record's identifier, then see whether a second test account can load that same record. If it can, access is too broad. Do this only with your own test accounts and test data.

The safe direction: Access should be scoped so each user can reach only their own data, usually by tying every row to an owner and enforcing that in the database rules or the server code. This is real security logic and easy to get subtly wrong, so it is a strong candidate for when a finding means hire a professional, particularly if the data is personal or financial.

Mistakes 4 to 6: authentication, uploads, and error leaks

4. Broken or absent authentication checks

What it is: Authentication is how your app confirms a user is who they claim to be, typically by logging in. Broken or absent means a page or action that should require login can be reached without one, or the login check exists on some routes but was forgotten on others.

The sign you can spot: Make a list of the pages and actions that should be private. Log out completely, then try to open each one directly by its address. Anything that loads its real content while you are logged out is a red flag. Pay special attention to routes the AI added later in the project, because that is where a forgotten check often hides.

The safe direction: Protected routes need a check that runs on the server and rejects requests without a valid session, applied consistently to every private route rather than page by page. Do not "fix" a stubborn auth error by removing the check to make it load, which only hides the hole. Authentication is a required-expert-review area: if strangers can reach data by skipping login, get a professional to review the auth layer before you keep building on it.

5. Unrestricted file uploads

What it is: If your app lets users upload anything, a profile photo, a document, a spreadsheet, unrestricted means it accepts files without checking what they are, how big they are, or where they end up.

The sign you can spot: Find your upload feature and test it gently with your own harmless files. Try uploading a very large file, or a file type you would not expect the feature to want, like a plain text file where an image is expected. If the app accepts whatever you give it without limits or type checks, the upload path is likely unrestricted. Also check where uploads land: if uploaded files are served straight back from a public location without any gatekeeping, that is worth noting.

The safe direction: Uploads should be limited by file type, capped in size, given safe generated names, and stored somewhere that does not simply execute or serve them blindly. Getting this right involves several moving parts, so uploads are on the required-expert-review list. Ask a professional to review the whole path from upload to storage to how the file is later served.

6. Verbose error messages that leak information

What it is: When something breaks, a verbose error shows the raw technical details, like database messages, file paths, or fragments of code, directly to the user instead of a plain "something went wrong."

The sign you can spot: Deliberately cause a harmless error in your own app, such as submitting a form with a required field empty or visiting a page that does not exist. Watch what appears. If you see internal details like server file paths, database table names, or long technical stack traces, your app is leaking information that helps nobody but an attacker mapping your system.

The safe direction: Users should see a friendly, generic error message, while the detailed version goes to your private logs where only you can read it. Ask your AI tool to "return a generic error to the user and log the details server-side." Confirm your app is not running in a debug or development mode in production, because that mode is a frequent source of oversharing errors.

Mistakes 7 to 9: rate limiting, insecure defaults, and missing authorization

7. No rate limiting

What it is: Rate limiting caps how many times someone can hit a given action in a short window, like login attempts or password resets. With none, a single source can hammer an endpoint thousands of times unimpeded.

The sign you can spot: You do not need to attack anything to notice this. Look at your login, signup, contact, and password-reset features and ask whether anything would stop the same visitor from triggering them over and over. If there is no lockout after repeated failed logins and no cooldown on messages or resets, rate limiting is probably missing. Your host's traffic logs showing bursts of repeated requests to one route are another tell.

The safe direction: Sensitive actions should be capped per user or per source over time, with escalating slowdowns or temporary lockouts on repeated failures. Many hosting platforms and authentication providers offer rate limiting you can switch on, so the fix is often configuration rather than new code. Ask your AI tool or provider docs how to enable it for login and other sensitive endpoints.

8. Insecure defaults left on

What it is: Tools and templates often ship with convenient but risky settings turned on for development, such as debug mode, permissive cross-site sharing, sample admin accounts, or test API keys. Insecure defaults left on means those never got tightened before launch.

The sign you can spot: Walk through your app's configuration and any dashboards for the services it uses. Look for anything labeled debug, development, test, or sample that is still active in production. Check for default usernames or passwords that came with a template. Look for settings that allow requests from any origin. If you never consciously changed these, assume they are still at their permissive defaults.

The safe direction: Before and after launch, review the security settings of every tool in your stack and move them from convenient to conservative: debug off in production, real credentials only, sharing restricted to the origins you actually use. This overlaps with vocabulary you may not know yet, so it can help to skim the security terms behind these mistakes as you go.

9. Missing authorization on API routes

What it is: Authorization is different from authentication. Authentication asks "are you logged in," authorization asks "are you allowed to do this specific thing." Missing authorization means a logged-in user can call an API route and act on data or actions that should be off-limits to them, like editing another user's record or reaching an admin-only function.

The sign you can spot: This is the subtle cousin of over-permissive data access, and it hides in the API layer behind your screens. With your own two test accounts, note an action that belongs to one user, such as editing a specific item. Then, while logged in as the other user, see whether the app lets that action go through against the first user's item. If a regular account can reach admin functions or touch records that are not theirs, authorization checks are missing. Keep this to your own test data only.

The safe direction: Every API route should confirm not just that the caller is logged in but that this particular user is permitted to perform this particular action on this particular resource. This is easy to describe and genuinely hard to implement correctly across a whole app, which puts it firmly in required-expert-review territory alongside authentication. If your app has any notion of roles, ownership, or admin power, have a professional review the authorization logic.

Which of these you can handle, and which need a professional

Detection is something you can do yourself. Every sign above is an observation you can make in your own app with your own test accounts and harmless test files. Running through all nine and writing down what you find is a completely reasonable weekend project for a non-technical owner, and it is the most valuable security work most solo builders are not doing.

Remediation is where the line falls. Some fixes are safely yours: moving secrets into environment variables, switching on rate limiting your platform already offers, turning off debug mode, tightening a default setting, adding straightforward validation rules. These are low-risk and reversible.

Others sit above the professional threshold, especially anything touching authentication, authorization, file uploads, payments, or personal data. Those are the areas where a well-meaning DIY fix can create a new hole or break access for real users, and where the cost of getting it wrong is highest.

WeaknessDetect yourselfFix yourselfProfessional threshold
Exposed secretsYesMove to env vars; rotateCoordinate rotation of live payment/DB keys
Missing input validationYesAdd basic server-side rulesIf it guards payments or PII
Over-permissive data accessYes—Almost always, if data is personal
Broken authenticationYes—Always (required review)
Unrestricted uploadsYes—Always (required review)
Verbose error leaksYesGeneric messages; logs off clientIf errors expose PII
No rate limitingYesEnable platform featureIf protecting login/payments at scale
Insecure defaultsYesTighten settingsIf defaults touch auth or payments
Missing authorizationYes—Always (required review)

A practical rule: if a fix involves deciding who is allowed to do what, or it touches money or personal data, get a second set of expert eyes. For the rest, you can make careful progress on your own. When you are unsure which side of the line you are on, when a finding means hire a professional walks through the judgment call and what to ask for.

This is educational, not legal or compliance advice. If your app handles payments, health information, or personal data covered by privacy rules, verify your specific obligations with a qualified professional.

In Plain English

What this means: AI coding tools tend to introduce the same nine security weaknesses, and each one has a warning sign you can look for without any technical attack. Spotting the sign is separate from fixing it, and knowing the difference tells you what to do next.

Who it helps: Solo founders, indie hackers, and citizen developers who shipped something with AI or no-code tools and suspect the security is loose but cannot name the specific problems.

When to use it: Before a launch, after adding any feature that touches logins, uploads, payments, or personal data, or any time that quiet security worry surfaces. Run the nine detection checks in an afternoon.

What to do next: Go through all nine on your own app and write down what you find. Fix the low-risk items yourself, and for anything touching authentication, authorization, uploads, payments, or personal data, book a professional review before building further.

Your next step

Turn these nine tells into a repeatable pass you can run every release with the Security Self-Audit toolkit checklist. If you have already found something and want a fix path, you can browse common fixes or start from the Secure hub. No rush and no alarm, just one calm loop you can run whenever you ship.


Kodbe is an independent commercial publication about maintaining and owning software built with AI or no-code tools. It is not affiliated with Kodbe Inc, Kodobe, Kodable, or Kodu.