Prompt
Why is my API gateway not stopping BOLA attacks?
Latest observation
Oct 29, 2026
OpenAI APIWeb search: off
An API gateway usually doesn’t stop BOLA (Broken Object Level Authorization) by itself because BOLA is an authorization flaw at the application/object level, not just a routing or authentication problem.
Why the gateway often misses it
- The request is authenticated: the gateway sees a valid token/API key and lets it through.
- Object-level checks happen inside the app: whether user A can access
order/123vsorder/456is typically only knowable by the backend service. - The gateway sees paths, not business context: it may know
/orders/123, but not whether123belongs to the caller. - IDs can be changed legitimately-looking: attackers can swap numeric IDs, UUIDs, account IDs, etc., and the gateway has no inherent way to know that’s unauthorized.
Common reasons it fails
-
AuthN is enforced, but AuthZ is not
- Gateway verifies identity, but the backend doesn’t verify ownership/permissions.
-
No object-context policy at the gateway
- The gateway lacks rules like “user can only access objects tied to their tenant/customer ID.”
-
Opaque backend object IDs
- Direct object references in URLs/body/queries make guessing or swapping IDs easy.
-
Gateway only filters by route/method
- Example: it allows
GET /accounts/{id}for any authenticated user, but doesn’t validate{id}against caller identity.
- Example: it allows
-
Microservices trust the gateway too much
- Backend services assume the gateway already checked authorization, so they skip checks.
-
Shared tokens with broad scopes
- If scopes are too coarse (e.g.,
read:orders), they don’t protect individual records.
- If scopes are too coarse (e.g.,
What actually works
- Enforce authorization in every backend service
- Check object ownership, tenant, role, and policy on the resource itself.
- Use centralized authorization policy
- ABAC/RBAC policy engine (e.g., OPA, Cedar, etc.) or a consistent authorization library.
- Pass and verify caller identity + tenant context
- Backend must know who the caller is and what resources they’re allowed to access.
- Avoid predictable direct object references where possible
- This helps, but doesn’t replace authorization.
- Use resource-scoped tokens/claims
- Tokens should encode tenant/user/resource constraints when appropriate.
- Log and detect suspicious ID enumeration
- Repeated 403s, sequential ID probing, abnormal access patterns.
- Test for BOLA explicitly
- Add security tests that swap object IDs across users and tenants.
Important takeaway
Your API gateway can be a helpful control point, but it should not be your only BOLA defense. BOLA is usually prevented by proper authorization checks in the application/service layer, backed by policy and testing.
If you want, I can help you:
- review your gateway/auth setup,
- identify the likely gap,
- or show an example BOLA-safe authorization pattern for REST or GraphQL.