The mistake
Checking that the caller is logged in, then loading, updating or deleting a record using an id from the URL, query string or body (/api/posts/42) without also filtering on the logged-in user.
Why it is dangerous
Any signed-in user can change the id and read, edit or delete everyone else's records. This is Broken Object Level Authorization (OWASP API #1), and it is the most common hole in generated CRUD code. Routes that change data with no authentication check at all, and user ids or roles taken from the request body instead of the session, are just as easy to abuse with a single curl.
How to fix it
Put the owner into the query itself, so a record that is not yours is simply not found (return 404), or load it and compare its owner with the session user (403):
Prisma: prisma.post.delete({ where: { id, authorId: session.user.id } })
Drizzle: .where(and(eq(posts.id, id), eq(posts.userId, session.user.id)))
Mongoose: Post.findOneAndDelete({ _id: id, owner: req.user.id })
SQLAlchemy: db.query(Item).filter(Item.id == item_id, Item.owner_id == current_user.id).first()
Django: get_object_or_404(Post, pk=pk, owner=request.user)
What this checker looks for
This page runs route-auth-check, which reads
Next.js, Express, Fastify, Hono, FastAPI, Flask and Django routes. The rules most relevant to this page:
| Rule | What it finds |
|---|---|
RAC002 | Record looked up by a request id with no ownership check (IDOR) |
RAC001 | Route changes data without any authentication check |
RAC004 | Next.js middleware does not cover the routes it seems meant to protect |
RAC005 | Admin route checks login but not the caller's role |
RAC006 | User id or role taken from the request instead of the session |
RAC008 | Whole request body written to the database (mass assignment) |
Every finding has a rule id, a severity, file:line, the offending line (secrets masked),
why it matters and how to fix it. Run route-auth-check rules for the full list.