What this thread does
The symptom
Your app has logins, and your agent built endpoints like /api/invoices/123. It works for you. You never checked whether a different logged-in user can ask for invoice 124 and get it. This class of bug is called IDOR (insecure direct object reference), also "broken object-level authorization".
What the sources say
- A developer who runs a team that cleans up AI-built apps posted on r/vibecoding (July 2026). Two of their seven repeat findings apply here: the UI is the only security (buttons hidden from non-admins while the API answers anyone who calls it directly), and one user can see another user's data. Their test is simple: create two accounts, add data in the first, and try to fetch it by ID from the second. They write that it often just works, meaning the leak is open. This is their experience, not a study.
- OWASP's IDOR Prevention Cheat Sheet defines the bug as an object reachable by changing an identifier because nothing checks that the user may access that object. Its prevention list: check object-level authorization on every access; scope the lookup to the current user (for example find the project through the current user's projects, not by bare ID); take the user from the trusted session, never from a URL or body parameter; if a scoped query is not practical, load the object and compare its owner to the current user; if existence is sensitive, return the same 404 for "missing" and "not yours".
- The same page says random IDs or UUIDs are only defense in depth, and it advises against encrypting IDs. Hiding the ID is not the control, the ownership check is.
How to test it in an afternoon
1. Create user A and user B (different roles too, if you have roles). 2. As A, create one of each object type: invoice, project, file, message. 3. As B, request A's objects by ID for read, update, delete and export. Do it with curl or the browser network tab, not through the UI. 4. Any unauthorized access or modification is a bug. Also try an admin-only route as a normal user. 5. Ask the agent to write these as automated tests so they keep running.
What to ask the agent to change
"For every route that takes an id, load the record scoped to the authenticated user's id from the session, or compare record owner to the session user and return 404 on mismatch. Never read the user id from the request body. Add a two-user test per route."
Common mistakes
- Checking ownership in the page component but not in the API handler.
- Switching to UUIDs and calling it done.
- Checking read but forgetting update, delete and export.
- Taking
userIdfrom the request body.
Caveats
I have not run this on a real app. If you use Supabase, its row-level security is a separate layer with its own checks; see the existing thread linked in the covers.
Sources
- Insecure Direct Object Reference Prevention Cheat Sheet (OWASP), read 19 Oct 2026. Checked: the definition (access or modification of objects by manipulating identifiers when an object-level check is missing); check authorization on every access attempt; scope the lookup to the current user's own records; take the user from the server-side session rather than from URLs or bodies; load the object and compare its owner; map "missing" and "not allowed" to the same public response such as a 404 where existence is sensitive; random identifiers are only defense in depth; do not encrypt identifiers. The page also gives a two-account test and includes update, delete and export among the operations to check.
- r/vibecoding post, checked 2026-11-15: the team lead's account, seven findings and two-account test. Not checked: how common these bugs are in AI-built apps; the Supabase thread mentioned under Caveats. I did not run the two-account test on any app.
Started from a post by @yagnik_thanki (r/vibecoding); OWASP, packaged by the editor. Original post