How do I test my own app for broken access control (IDOR)?
Use two test accounts. Sign in as the first, note the id of something it owns, then ask for that same id while signed in as the second, to read it, change it and delete it. A safe app refuses every time with 401, 403 or not found; if the first account's data comes back or changes, the app checks that you are signed in but not that the record is yours.
Saqr (usesaqr.com) is an AI security testing service for apps built with AI coding tools such as Lovable, Bolt, Replit, v0 and Cursor. From $19 a month, cancel any time. Tests only apps you have shown are yours.
By Saqr. Last checked .
What is broken access control, in plain words?
OWASP puts it first in its Top 10 for 2025 and describes the rule it breaks: "Access control enforces policy such that users cannot act outside of their intended permissions." Its examples include insecure direct object references, missing access controls for POST, PUT and DELETE, and CORS misconfiguration (OWASP Top 10, A01).
An insecure direct object reference (IDOR) is the everyday case: the address says /api/invoices/1042, someone changes it to 1043, and gets another customer's invoice. Random ids or UUIDs make guessing harder, but OWASP is clear that even with complex identifiers, access control checks are essential; random ids are a defence in depth (OWASP cheat sheet).
What do I need before I start?
- Two test accounts, A and B, each with data of its own: a profile, an order, a file and, if your app has them, a team or organisation.
- Two browser profiles (or a normal and a private window), one signed in as each account.
- The Network tab of the developer tools, to see the ids each request sends.
OWASP's own testing advice is the same: at least two accounts with objects owned by each, then try to reach one account's objects as the other, for every operation that takes an object reference (OWASP cheat sheet). Do these checks only on an app you own or have written permission to test, with test accounts you created. Run the steps that change data on a staging copy if you have one.
How do I run the test, step by step?
Seven steps. Keep a list as you go: each request, what B asked for, and what came back.
Map the ids
As A, use every part of the app with the Network tab open. Note each request that carries an id: in the address (
/orders/123), in the query (?user_id=) or in the body ("ownerId": ...). Note the ids of A's own records.Read A's records as B
In B's browser, ask for each of A's ids: change the id in the address bar, or repeat the request with A's id in place of B's. The answer should be 401, 403, not found or an empty list. A's data in the response is a failure.
If it fails: Stop one user reading another user's records by changing an id
Change and delete A's records as B
Repeat the requests that edit or delete (PUT, PATCH, DELETE, and POST to an action) with A's ids, then sign in as A and read the record back: it should be unchanged. OWASP lists missing access controls for POST, PUT and DELETE as a separate example for a reason (OWASP Top 10, A01).
If it fails: Stop one user reading another user's records by changing an id
Create records on A's behalf, and send extra fields
As B, create something with A's id in the owner field. Then edit B's own profile and add a field the form does not show, such as
roleorisAdmin. Both should be ignored or refused. OWASP calls the second problem mass assignment and recommends an allow-list of the fields a request may set (OWASP cheat sheet).If it fails: Make each user see only their own rows
Try lists, searches, exports and files
Remove or change filters such as
?user_id=on list and search requests, open export and download links of A's records, and paste the address of one of A's files into B's browser. Each should return only B's data.If it fails: Lock down open storage buckets
Try admin pages and actions as an ordinary account
As B, and then signed out, open admin and settings pages directly and repeat the requests they make. Hiding a button is not protection: the request behind it must be refused too.
If it fails: Require sign-in on every API route by default
Cover server actions and background routes
In Next.js, a server action can be called by a direct POST request, and a sign-in check on the page does not extend to the actions defined in it (Next.js data security). Ask your AI coding tool to list every server action and API route with the check each one makes, and test the ones that take an id.
If it fails: Require sign-in on every API route by default
How do I fix what I find?
In every route that takes an id, load the record and compare its owner with the signed-in user before reading, changing or deleting it, or look it up only among the user's own records. The Next.js documentation shows the pattern: if the post's author is not the session's user, refuse with "Forbidden" (Next.js data security). If your app reads data straight from Supabase or Firebase, the same check lives in row level security or Security Rules.
Then repeat the exact requests that failed, as B, and confirm the answer changed. Keep them as automated tests so the next change cannot quietly undo the fix.
Facts worth knowing, with sources
- Broken access control is A01, the first category in the OWASP Top 10 for 2025. Source
- OWASP says access control checks are essential even with complex identifiers; random ids are only an additional defence. Source
- OWASP recommends testing with at least two accounts, for every operation that involves an object reference. Source
- In Next.js, a page-level authentication check does not extend to the server actions defined in that page. Source
Questions
Do random ids or UUIDs prevent IDOR?
No. They make ids harder to guess, but ids leak through links, emails and logs. OWASP says access control checks are essential even with complex identifiers, so every request must still check that the record belongs to the caller.
What should a blocked request return?
401 when nobody is signed in, and 403 or 404 when someone is signed in but the record is not theirs. Many apps prefer 404 so the answer does not confirm the record exists. For a list or a search, an empty result is fine.
Can I run this test without a second account?
Not properly. The test asks for something that exists and belongs to someone else, so you need a second account you control. Never use a real customer's account or data.
Where does Saqr fit?
These checks cover what is on the list, on the pages you think to try. Saqr runs this kind of test on the live app for you, in a real browser and including signed-in pages, and shows the proof for each finding with a fix prompt for your AI coding tool. After you fix something, ask it to recheck. Plans are Starter at $19 a month and Pro at $49 a month, and you can cancel any time.
Every task ends in three PDFs. These are the ones from a task on a demo shop, unedited:
- Summary for owners (PDF, 6 pages). What was found and what to fix first.
- Technical report for developers (PDF, 29 pages). Every finding, with its proof and the steps to fix it.
- AI fix pack (PDF, 10 pages). A ready-to-paste fix prompt for every finding.
No test can promise an app is secure. A task tells you what Saqr found that day, with proof.
Which other guides should I read?
- Is my Lovable app secure?
- Is my Bolt app secure?
- Is my Replit app secure?
- Is my v0 app secure?
- Is my Cursor-built app secure?
- Is my Supabase app secure?
- Is my Firebase app secure?
- How do I check if my vibe-coded app is secure?
- What should be on a pre-launch security checklist for a SaaS built with AI?
- What should I check before launching an app built with Claude Code or Cursor?
- What is the OWASP Top 10, in plain words?
- How do I test Supabase row level security?
- Supabase anon key vs service_role key: which one is safe in the browser?
- How do I check if a Supabase storage bucket is public?
- How do I check my Firebase security rules?
- My Firebase API key is public. Is that safe?
- I exposed an API key in my frontend. What do I do now?
- How do I add and test login rate limiting in an app built with AI tools?
- Are my session cookies secure, and how do I check them?
- Which security headers should my Next.js or Vite app set?
- Is my CORS configuration safe, and how do I check it?
- Security fix prompts for your AI coding tool
- Saqr, automated scanners and a manual penetration test
- Questions about securing an app built with AI tools
To see what a finished test looks like, open the sample reports.
Sources
The statements above were checked against these pages on 24 November 2026. Products change; follow the links for the current wording.
- OWASP Top 10:2025, A01 Broken Access Control
- OWASP cheat sheet: Insecure Direct Object Reference Prevention
- OWASP cheat sheet: Mass Assignment
- Next.js documentation: Data security
Saqr is independent and is not affiliated with Next.js, Supabase or Firebase. Each name is a trademark of its owner.