Broken object level auth

From zakirkun/ice-tea · View interactive version

Broken object level auth is an AI agent skill from the GitHub repository zakirkun/ice-tea. Detects API endpoints that use user-supplied IDs to access objects without verifying the requesting user owns or has permission to access that object.

How to use this skill

Skill file

Broken Object Level Authorization (BOLA / IDOR)

Overview

BOLA (also called IDOR — Insecure Direct Object Reference) is the #1 API vulnerability. It occurs when an API endpoint uses a user-supplied ID (from URL, query parameter, or request body) to access an object without verifying that the current user is authorized to access that specific object.

Example: GET /api/v1/users/{userId}/orders — if userId from the path is trusted without checking that the authenticated user matches userId, any user can access any other user's orders.

Detection Strategy

Remediation

Always scope database queries to the authenticated user's context.

Vulnerable (Express.js):

app.get('/api/orders/:orderId', auth, async (req, res) => {
    const order = await Order.findById(req.params.orderId); // No ownership check!
    res.json(order);
});

Safe:

app.get('/api/orders/:orderId', auth, async (req, res) => {
    const order = await Order.findOne({ _id: req.params.orderId, userId: req.user.id });
    if (!order) return res.status(404).json({ error: 'Not found' });
    res.json(order);
});
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.