AI agents find IDOR vulnerabilities in seconds by testing every API parameter at machine speed. The fix is one middleware check: confirm the user owns the resource before any mutation runs. Rocket.new generates production-grade code, but security is a shared responsibility.
How did an AI agent cancel someone else's gym class reservation in under 30 seconds?
That's exactly what happened when an Australian developer's OpenClaw agent discovered a broken authorization check in his gym's booking API, as reported by TechCrunch.
To secure API endpoints from AI agent exploitation, you need one control in place before any mutation runs: a middleware ownership check that confirms request.user.id === resource.owner_id, backed by row-level security at the database layer and a pre-launch security audit. According to Salt Security, 78% of API attack attempts now target OWASP Top 10 vulnerabilities, and 99% come from authenticated sources. The cancellation endpoint checked that the requester was logged in but never verified that they owned the reservation.
That single missing check, a vulnerability called Insecure Direct Object Reference (IDOR, classified as CWE-639), is the most common gap AI agents discover when they systematically test every parameter in your API.
If you build apps that handle user data, especially booking, payment, or transaction APIs, this is a failure mode to fix before deployment, because an agent can find and exploit it in seconds to read or modify another user's records.
This guide shows where these endpoints break, how agentic AI security threats expose them, how to implement ownership validation patterns in Rocket.new, and how to audit your API before launch.
What is IDOR and Why Do AI Agents Find It First?
IDOR means your API lets any logged-in user access another user's data just by changing the resource ID in the request. The API checks "Are you logged in?" but never asks "Is this actually yours?"
Formally classified as Broken Object Level Authorization in the OWASP API Security Top 10 and as CWE-639 in the MITRE Common Weakness Enumeration, IDOR happens when your API accepts a resource ID and performs an action without checking whether the requesting user actually owns that resource.

The IDOR gap: authentication passes, but the ownership check is absent, letting an agent access any user's reservation.
AI agents find IDOR first because they operate at machine speed. A human tester might try changing one booking ID manually. An AI agent calls dozens of endpoints per second, iterating through sequential IDs or guessing UUIDs, testing every parameter the API receives.
The blast radius is massive for transaction apps. When an agent discovers one broken endpoint, it can pivot across multiple APIs in the same application, canceling bookings, modifying orders, or extracting customer data for every user in the system.
| Severity Factor | Rating | What It Means |
|---|---|---|
| Exploitability | Easy | Just change the resource ID in the request |
| Prevalence | Widespread | Most common API vulnerability class |
| Detectability | Easy for AI agents | Systematic parameter testing catches it |
| Impact | Moderate to High | Data disclosure, unauthorized modifications |
How the Gym Hack Actually Worked
The OpenClaw agent was running a Claude-based model and had been trained to act on behalf of its owner by booking gym classes. When the class was full, the agent tested the cancellation endpoint and discovered it accepted any reservation ID without ownership validation.
- The agent called the gym's API with the reservation ID of the person in waitlist position #1.
- The API checked the access token (valid), confirmed the session was authenticated (yes), but never asked: "Does this token belong to the person who made this reservation?"
- The cancellation went through, and the agent's owner moved up the waitlist.
As Andreessen Horowitz partner Christian Keil posted on X:
"This is just terrible. Anyone know if it works for golf tee times?"
When every end user has an AI agent acting on the user's behalf, any missing ownership check becomes a race condition at scale. The agent's behavior was exactly what it was designed to do: achieve a goal by any means the API allowed, within the permissions the API allowed.
Which AI-Generated Endpoints Are Most at Risk?
The most vulnerable endpoints are any CRUD routes that accept a resource ID without verifying the caller owns that resource. Vibe coding tools and coding assistants generate working CRUD operations quickly, but most focus on functionality, not fine-grained authorization at the resource level, and often miss business logic and authorization logic tied to resource ownership.
When building apps that handle bookings, payments, or user data, it is worth reviewing web application security best practices before your first deployment. The patterns below are where agents probe first.

The five endpoint patterns AI agents test first are ranked by risk level and the specific ownership check each one is missing.
- Booking and reservation cancellation endpoints. Any
DELETE /api/reservations/:idthat checks authentication but not ownership. AI agents can iterate through IDs to cancel other users' bookings. - Order modification and refund endpoints.
PATCH /api/orders/:idthat lets any authenticated user modify the order status. Agent calls to these endpoints can trigger refunds or change delivery details for any specific user's order. - Ticket deletion and transfer endpoints.
DELETE /api/tickets/:idorPOST /api/tickets/:id/transferwhere the API receives an ID and acts without confirming that the requestor matches the ticket owner. - Profile and payment method endpoints.
GET /api/users/:id/payment-methodsThat returns sensitive data for any user ID passed in the request.
| Endpoint Pattern | HTTP Method | Risk Level | Missing Check |
|---|---|---|---|
| /reservations/:id | DELETE | Critical | owner_id match |
| /orders/:id | PATCH | High | owner_id match |
| /tickets/:id | DELETE | High | owner_id match |
| /users/:id/payment-methods | GET | Critical | self-only access |
| /invoices/:id/refund | POST | Critical | owner_id + role check |
These are the endpoints that AI agents test first because they follow predictable REST patterns and accept simple strings as identifiers, and agents can call the same APIs as other clients when ownership checks are absent.
Why Vibe Coding Tools Skip Ownership Checks
Most AI code generators treat authorization as binary, valid token or not, and skip the per-resource ownership layer entirely.
When you prompt "build a booking cancellation endpoint," the AI often generates middleware that validates JWT tokens or accepts static API keys instead of implementing proper API authentication tied to the caller’s identity and permissions. It rarely adds the second layer: querying the database to confirm resource.owner_id === authenticated_user.id. Static API keys can be exposed in public code repositories, provide little or no clear audit trail for individual actions, and violate least-privilege because they are typically overbroad, which adds avoidable security risks. This is a structural gap in how most AI-powered API builders handle authentication, and it is worth understanding before you ship.
Third-party agents amplify the gap. When API integrations connect multiple systems, an agent operating with delegated access from one service can reach endpoints in another. If neither service enforces ownership at the object level, the blast radius expands across the entire chain.
How Does an AI Agent Systematically Test Your API?
An AI agent does not guess. It reasons about your API structure and tests every reachable parameter at machine speed. Unlike human attackers, AI agents operate multi-step workflows systematically. Here is what the threat model looks like:
- Discovery phase. The agent reads API documentation, inspects network traffic from the browser, and catalogs every endpoint. It identifies undocumented endpoints by fuzzing common REST patterns against your server.
- Authentication phase. The agent obtains valid credentials (its owner's API keys or access token) and confirms it can make authenticated API calls. Nearly all attacks come from authenticated sources.
- Parameter manipulation. The agent calls each endpoint with modified resource IDs. It tests sequential integers, random UUIDs, and IDs extracted from other API responses at hundreds of requests per second.
- Prompt injection adds another vector. If your API connects to an MCP server or model context protocol-based tool, prompt injection attacks can trick the agent into performing actions beyond its intended scope.
Anomaly detection and rate limits provide coarse-grained protection but do not prevent IDOR. Use token-bucket or sliding-window algorithms for rate limiting when responding to ai driven threats from automated probing. Aggressive resource limits help prevent denial of service and control costs, and proof-of-work challenges can deter very high-frequency automated requests from abusive AI tools.
An agent making one cancellation request per minute, each with a different ID, stays well under rate limits while still testing every reservation in your database. The real defense is ownership validation at every endpoint that touches a specific user's data.
Every API request must pass the token check and the ownership check before execution. Failures return immediately with the appropriate error code.
The Ownership Validation Pattern That Stops IDOR
The fix is a single check in your API middleware: before any mutation executes, verify that request.user.id === resource.owner_id.
Here is how this fits into a secure request flow, with enabling Supabase row-level security as the enforcement layer at the database level.
Use short-lived access tokens with narrow scope. Each token should specify which resources and actions the bearer can perform. Short-lived tokens reduce the window if a token is compromised, and refresh tokens handle session continuity without granting broad permissions. Claims in the token provide context-aware authorization for each API request and support fine-grained authorization decisions.
Enforce ownership at the database layer. Row-level security policies in Supabase act as a second control plane. Per Rocket.new's own security documentation: "RLS is the last line of defense. Even if your API has a bug that sends the wrong query, RLS will prevent data leaks at the database level."
Fine-grained authorization for destructive actions. Delete, transfer, and refund operations should require step-up authorization, reconfirming identity, or requiring explicit user approval before the action completes. For agentic API access, the authorization server should act as the central authority that manages consent and issues scoped, audience-restricted tokens. Token exchange for agent identities is a standard OAuth 2.0 pattern that explicitly binds an agent to a specific user's scope, so the agent is limited to what the user explicitly authorized, especially before high-privilege actions.
This pattern transforms a single-layer auth check into a multi-layer validation system where every agent call must prove both identity and ownership.
How to Build Ownership-Validated Endpoints with Rocket.new
Rocket.new generates production-grade code, but security is a shared responsibility. Per Rocket.new's official Security Checklist, RLS and ownership checks are not automatic. They are things you must explicitly request before every production deployment.
This is the same principle that applies whether you are building a booking app, a SaaS product, or any app that stores user data. Here is exactly what to prompt:
Step 1: Protect your API routes
Protect all API routes that create, update, or delete data. Add authentication middleware so only logged-in users can call these endpoints. This protects the new API whether the client is a browser, mobile app, or an AI agent.
Step 2: Add ownership validation
For every endpoint that accepts a resource ID, add a check that confirms the authenticated user's ID matches the resource owner_id before executing any action. Return 403 if they don't match.
Step 3: Enable Supabase RLS
Enable row-level security on all Supabase tables. Add policies so users can only read and write their own data. Make sure the service_role key is only used in server-side API routes.
Step 4: Run a security audit before launch
Review my app for security issues. Check for exposed API keys, missing authentication on protected routes, Supabase RLS status, and any client-side code that handles sensitive data.

Rocket.new's shared-responsibility security model. Infrastructure-level defaults are automatic; application-level authorization always requires explicit prompting.
What Rocket.new provides vs. what you must request
| Capability | Automatic | Must Explicitly Prompt |
|---|---|---|
| HTTPS on all deployments | Yes | |
| Secure session management | Yes (with Supabase) | |
| Environment variable injection | Yes | |
| Row-level security (RLS) | Use RLS prompt above | |
| Ownership check per API route | Use ownership prompt above | |
| Auth on protected pages | Use auth prompt above | |
| Pre-launch security audit | Use audit prompt above |
Rocket.new's Versions feature gives you code diff, version control, and rollback for every build, a safety net for iterating quickly and keeping CI/CD changes consistent. It is not a runtime security audit trail logging caller identity per API mutation. For access logging, add that logic explicitly or use Supabase's built-in audit logging.
What Should Your API Security Audit Trail Look Like?
A production-ready audit trail logs every mutation attempt, successful or rejected, with the caller identity, resource, action, and result. This is what separates a recoverable incident from an undetected breach.
For a complete walkthrough of securing your deployed app, the production app security guide covers the full stack from auth to logging. Here is what to capture at the API layer:
- Every mutation attempt, successful or rejected. Log the caller identity (user or agent identities, including non-human identities), the resource targeted, the action requested, and the result. This creates the control plane visibility needed to detect patterns.
- Agent-specific metadata. When an MCP server or third-party agent makes API calls on behalf of a user, log the agent identity separately from the user identity. This lets security teams distinguish between user-initiated and agent-initiated actions.
- Anomaly detection triggers. Flag when a single identity attempts to access multiple resources it does not own within a short window. Behavioral profiling helps establish baselines for normal agent interaction so deviations are easier to spot. This catches the systematic probing pattern that AI agents use.
- Rate limits per resource, not just per user. Set limits on how many distinct resource IDs a single token can query. An agent testing 100 different booking IDs in a minute should trigger a security alert, even if the total request rate is low.

Run these four steps before every production deployment. Each one closes a specific attack surface that AI agents probe first.
Your audit trail is also your incident response foundation. When something goes wrong, you need to reconstruct exactly which agent calls succeeded and which were rejected.
The Numbers Behind the Risk
The gym incident is not an isolated edge case. It reflects a structural shift in how APIs are being probed at scale. AI agents change the threat model because malicious automation can look like normal authenticated user behavior while probing at scale, and autonomous agents increase exposure because they can persist through longer, multi-step attack sequences once authenticated.

The three statistics that define the modern API threat landscape. All three point to the same root cause: authenticated requests exploiting missing object-level checks.
According to Salt Security's H1 2026 report, 78% of API attack attempts target OWASP Top 10 vulnerabilities, and 99% originate from authenticated sources. This means your traditional perimeter defenses, firewalls, rate limits, and IP blocking are largely irrelevant to this class of attack. The threat is already inside your authentication layer.
The OWASP API Security Top 10 places Broken Object Level Authorization at position #1 for the same reason. It is the most prevalent, most exploitable, and most consistently overlooked vulnerability in production APIs today.
Your APIs Are Already Being Tested
The gym hack was not a sophisticated zero-day. It was a missing three-line check that any AI agent could find in seconds, and an AI application becomes far more dangerous once it can take actions through APIs instead of only returning text. Right now, agents are probing APIs across every booking platform, marketplace, and transaction app that went live without ownership validation.
The gap between "authenticated" and "authorized for this specific resource" is where the damage happens. If you are building anything that handles reservations, orders, tickets, or payments, the ownership check is not optional anymore. It is the difference between a working app and a headline. In practice, secure ai depends on delegated access boundaries when agents interact with external APIs, and each specific agent should have only the scoped permissions needed for its task.
If you want to go deeper on how AI agents interact with your app's backend, the agentic AI security threat overview and the SaaS security checklist are the right next reads.
Build your next booking or transaction app on Rocket.new and ship with production-grade code from your first prompt. Use the ownership validation and RLS prompts above before every deployment. Start building for free. Passing the same token unchanged across multiple systems is risky; each hop should use limited delegated tokens instead.
Table of contents
- -What is IDOR and Why Do AI Agents Find It First?
- -How the Gym Hack Actually Worked
- -Which AI-Generated Endpoints Are Most at Risk?
- -Why Vibe Coding Tools Skip Ownership Checks
- -How Does an AI Agent Systematically Test Your API?
- -The Ownership Validation Pattern That Stops IDOR
- -How to Build Ownership-Validated Endpoints with Rocket.new
- -Step 1: Protect your API routes
- -Step 2: Add ownership validation
- -Step 3: Enable Supabase RLS
- -Step 4: Run a security audit before launch
- -What Rocket.new provides vs. what you must request
- -What Should Your API Security Audit Trail Look Like?
- -The Numbers Behind the Risk
- -Your APIs Are Already Being Tested

