AI coding tools miss access control because nobody tells them the rules. In a 2026 audit of 200 deployed apps written mostly by AI, the largest root cause of confirmed flaws was security requirements the user never stated, and broken access control was the largest category of flaw. You catch it by writing those rules into every prompt and ticket, reviewing who can see what before you build more, and testing with two accounts before launch.
AI coding tools got better at the old bugs
For years the classic worries about generated code were SQL injection and cross-site scripting. SQL injection lets an attacker slip database commands into a form field. Cross-site scripting lets an attacker run their own script in another user's browser. Both follow well-known patterns, and coding agents have learned many of them.
In a test by Tenzai, a security startup, five coding agents (Claude Code, OpenAI Codex, Cursor, Replit and Devin) each built the same three apps from identical prompts. None of the 15 apps had an exploitable SQL injection or cross-site scripting flaw, according to SecurityWeek's report on the test. Yet every one of the five agents introduced server-side request forgery, a flaw that lets an attacker make your server fetch an address of their choosing, including systems inside your network. Four of the five accepted negative order quantities where the prompt never said orders must be positive, and three of the five accepted negative prices. Tenzai said one of the most common problems was improper authorization when calling APIs.
Other vendor tests point the same way. Xint, an AI penetration testing platform from the security firm Theori, found 434 exploitable issues across three test apps, led by missing rate limits and authorization flaws, with injection barely present, SecurityWeek reported. The old bugs have not vanished from raw model output. In Veracode's October 2026 tests of 18 models (Veracode sells application security testing), 38% of outputs written without security guidance contained a known vulnerability. Models passed the SQL injection checks 84% of the time but the cross-site scripting checks only 18% of the time. Still, in full apps built by agents, the bigger problem has moved to the rules the app is supposed to enforce.
What are hidden security rules?
A hidden security rule is a requirement your app needs in order to be safe that nobody wrote down. Your prompt says "let users view their invoices." It does not say "only their own invoices," "check that on the server," or "never accept a negative total." The model builds the feature you asked for. The rules you never stated are the ones it is most likely to skip.
A 2026 preprint by researchers from Microsoft, the National University of Singapore and an independent author measured this. They audited 200 deployed open-source apps written mostly by AI. Of those, 182 (91%) had at least one vulnerability, and the authors confirmed 1,186 flaws as exploitable. Broken access control was the largest category at 28.58% of flaws, found in 64% of the apps. Injection came second at 16.78%, so the old bugs still deserve a scanner. The largest root cause, 658 flaws or 55.5%, was what the authors call hidden security rules, meaning code that broke a requirement needed for safety but never stated in the user's request (arXiv 2606.23130). The paper has not yet been peer reviewed.
Broken access control means the app lets someone see or do something outside their permissions. The textbook case is an insecure direct object reference, where you change the number in a web address from your invoice to someone else's and the app shows it. OWASP's Top 10 for 2025 keeps broken access control at number one and counts server-side request forgery among the weaknesses in that category.
Why scanners struggle to see access control
Access rules depend on facts a scanner cannot see, such as which user owns which record, which role may approve a refund, and which customer may open which file. Those facts live in your head, your contracts and your pricing. The code only shows whatever the model guessed.
Research on AI-assisted reviewers shows the limit. In a study by Semgrep, which sells code scanning, Claude Code found 13 real authorization flaws of the kind that let one user read another's records, along with 46 false alarms. When the checks were spread across the app or applied implicitly in middleware, none of its reports were real, 0 of 19 and 0 of 18. The authors concluded that a human in the loop is still essential (Semgrep).
Platform checks share the same boundary. Supabase tells users to check its advisor findings against their intended schema and access model before changing anything (Supabase docs). The researcher behind the 2025 Lovable row level security disclosure found that Lovable's original scan checked only whether a policy existed, not whether it was correct (Matt Palmer). A scan can tell you a rule exists. You are the one who knows whether it matches your business. We cover that gap in Your AI Builder's Security Scan Is Not a Security Review.
Write the security rules into every prompt and ticket
If the root cause is unstated rules, the first fix is to state them. A small 2026 twin-prompt study tested exactly this. The author generated six web apps twice with the same AI coding assistant, once with a security requirements section added to the prompt and once without. The versions with the added section had 24 confirmed findings against 51 for the plain versions, and none rated Critical or High (arXiv 2608.20963). The author calls the study preliminary, and the most severe finding turned up only in manual testing. Better prompts lower the count, and you still have to test.
Write the rules as plain sentences in every prompt and ticket that touches data. Cover these six points.
- Ownership. Each record belongs to one account. Say who may read it, change it, delete it and export it.
- Server-side checks. Every permission check runs on the server or in database rules, never only in the browser.
- Value rules. Quantities and prices must be positive and within limits, and totals are computed on the server from stored prices.
- Outbound requests. If the app fetches a web address, it may reach only a fixed list of domains.
- Secrets. Keys stay on the server, never in browser code or the repository.
- Abuse limits. Sign-in, password reset and expensive endpoints get rate limits.
Here is a requirement short enough to paste into any ticket. Each invoice belongs to one account. Users may read invoices only for accounts they belong to. Only account admins may delete them. Enforce this on the server and in database policies, and reject zero or negative quantities. The model now has the rule it was missing, and your reviewer has something concrete to check.
Review who can see what before you build more
A design review of access is a short meeting with a table. List your roles down the side and the records they might touch across the top, then fill in what each role may do. Compare the table with what the app does today.
| Role | Own records | Others in the same account | Other accounts |
|---|---|---|---|
| Visitor, not signed in | None | None | None |
| Member | Read and edit | Read, if shared | None |
| Account admin | Read, edit, delete | Read, edit, delete | None |
| Your support staff | Through a logged support tool | Through a logged support tool | Through a logged support tool |
Watch the "Other accounts" column most closely, because it holds the rule nobody says out loud. If your app runs on Supabase, the table translates directly into row level security policies, and our Supabase row level security guide shows how to write and test them. Once the table exists, have a person review every AI-generated change that touches it. We describe that habit and five others in Building Fast Without Building Exposed.
How do you test access control? Use two accounts
The fastest way to find broken access control is to try it yourself. The two-account test needs no special tools.
- Create two ordinary user accounts in two separate browsers, each with its own fake records. Never use real customer data.
- As account A, note the web addresses and record IDs. Your browser's developer tools show the API calls the app makes.
- As account B, try to open, edit and delete A's records by swapping IDs in the addresses and API calls.
- Sign out and repeat the same calls with no login at all.
- Try the side doors, such as file downloads, exports, search, invite links and anything an AI feature can fetch.
- Try the value rules with a negative quantity, a zero price and a discount code used twice.
Anything that crosses over is a finding. The full method is in The Two-Account Test. In a Compliance Readiness Review we run this test with fake records and tie every finding to the SOC 2, HIPAA or PCI DSS requirement it affects.
Why access control decides your next security review
Customer security questionnaires and SOC 2, HIPAA and PCI DSS reviews all ask how you control access to data. Cybersecify, a penetration testing firm that writes about SOC 2 readiness for AI-built apps, maps row level security left switched off to SOC 2's logical access criterion, CC6.1 (Cybersecify). A flaw that lets one customer read another's records is the kind of finding that stalls a deal long before anyone attacks you. Fix it while the rules still fit in one table. Our page on apps built with AI coding tools covers the other places these apps tend to slip.
Where to start this week
Write the access rules for your three most sensitive tables as plain sentences, add them to your next prompt, then run the two-account test against them. For a quick read on where you stand, take the free 2-minute self-check. Our pillar guide, Is Your Vibe-Coded App Safe to Sell?, covers the rest of a pre-launch review.
If a customer, partner or deadline is already waiting, the Compliance Readiness Review maps your data, tests access with two accounts and fake records, and gives you a ranked plan tied to the framework your customer cares about.