Back to all posts
AI Development

AI coding agents' worst security hole is letting one user see another's data: test it with two accounts

AI-built apps leak customer data through predictable gaps, and this post shows how to test for the worst one with two accounts and how to check five more before real users arrive

Today in AI (2026-10-20)

AI coding agents leave the same security gaps again and again. They are not random. The agent is trying to make your feature work, and security is the part of "working" nobody asked for, so it gets skipped.

The good news is that the gaps are predictable, and you can check for most of them without reading a line of code. Below are six, each with a plain explanation and a check you can ask for or run yourself.

I build MVPs with Claude Code on Cloudflare daily, and I have reviewed agency-built and contractor-built codebases as an interim or fractional CTO. The pattern is consistent: the app demos fine, and the holes sit where nobody was looking.

Why agents skip security

An agent optimizes for what you asked. "Let users save a project" produces a screen that saves a project. It does not automatically ask, "Should user A be able to read user B's project?"

Security is mostly about things that should not happen. Those rarely appear in a prompt, so they rarely appear in the code. If you want a deeper checklist for launch day, I covered data access, secrets and backups in this production-readiness post. This post goes wider on the code itself.

The six gaps and how to check each

1. Missing permission checks

This is the most common one. The app checks that you are logged in, but not that the record you request is yours. Change a number in the web address (say, from /invoice/101 to /invoice/102) and you see someone else's invoice.

Check: create two test accounts. Log in as the first, copy the address of one of its records, then open it while logged in as the second. If it loads, you have this bug. Ask the agent to add an ownership check on every page or action that reads or changes data, then repeat the test.

2. Secrets sitting in the code

A secret is a password-like key that lets your app talk to a paid service (payments, email, the AI provider itself). Agents sometimes paste these straight into files, and files end up in version history or in the browser.

Check: ask the agent to search the whole project, including past history, for keys and passwords. Confirm secrets live in your hosting provider's secret settings, not in the code. If a key was ever exposed, replace it. Deleting the line is not enough, because the old key still works.

3. Trusting what the user types

Any form field, upload, or web address can carry hostile input. Agents often pass it straight to the database or the page. The classic result is someone typing database commands into a search box and getting your data back.

Check: ask the agent, "Where does user input reach the database or the page, and is each one validated?" Then try it yourself: enter a very long string, odd symbols, and a snippet of HTML in every field. If the page breaks or renders the snippet, the input is not handled.

4. Security that only exists in the browser

Agents love hiding a button from non-admins. But hiding a button is decoration. Anyone can send the request the button would have sent.

Check: log in as a normal user and ask the agent to list every action that is "admin only." For each, confirm the server refuses the request, not just the screen. A founder-level test: have a technical friend try those actions without using the interface.

5. Packages nobody vetted

Agents install open-source building blocks (packages) freely. Some are abandoned, some have known flaws, and occasionally an agent invents a package name that an attacker has since registered.

Check: ask for a list of everything installed and why. Run the standard vulnerability scan for your stack (the agent can set it up in a few minutes). Remove anything you cannot justify. Fewer packages means fewer doors.

6. Overly open settings left from development

To get past errors, agents often loosen things: let any website send requests to your app (which means a malicious site can act on behalf of your logged-in users), turn off protections, leave on developer-only pages that expose internal details, or give the database account full power. Those settings tend to survive into production.

Check: ask, "What did you loosen or disable during development, and what should be tightened before launch?" Make it a written list and go through it item by item.

Common mistakes

  • Asking the same agent to grade its own work and accepting "looks secure." Ask for specific evidence: which pages and actions, which checks, which tests.
  • Testing only as the admin. Most gaps only show up when you act as a different user.
  • Fixing the symptom. If one page lacked a permission check, others probably do too. Ask the agent to audit all of them.
  • Skipping the second reviewer. A fresh pair of eyes, human or a separate review tool, catches what the builder's habits miss. My broader AI code review checklist covers what else to look for.

What has changed recently

Models keep getting faster and cheaper. MiniMax says its new M3.1 Flash runs nearly three times faster and cuts usage costs by 70%, and it lists cybersecurity among its improved areas. Faster, cheaper agents mean more code gets written per day, which means more places for these gaps to appear unless you review as you go.

I have not used that model, so I will not claim it writes safer code. Treat vendor claims as a reason to test, not a reason to relax.

The practical shift: since writing code is now cheap, spend the savings on checking it. A security pass costs far less than a leaked customer list.

What to do this week

  1. Create two test accounts and try gap 1 on your most important screen. It takes ten minutes.
  2. Ask your agent the three questions above: where input is validated, what is admin only, and what was loosened during development.
  3. Search for exposed secrets and replace any that ever touched the code.
  4. Put the six gaps in a document and make "checked" a requirement before any release.

If gap 1 fails, stop adding features until it is fixed. Everything else is secondary to making sure one customer cannot see another's data.

Written by Hootan Nikbakht

Building something?

Get a second opinionbefore it costs you a quarter

I build MVPs for non-technical founders and step in as interim CTO when there's a leadership gap. If this one hit close to home, bring me the repo.

Or email hootan@nikfam.ai.