Cluster 9 · OWASP API1:2023 · Broken Object Level Auth

Auditing BOLA / Object-Level Authorization Gaps in OpenAPI Specs

How to detect Broken Object Level Authorization (OWASP API1:2023) blindspots across {id} routes in OpenAPI 3.0/3.1 specs using explicit security scopes, tenant path bindings, and mandatory 401/403 contracts.

Zero Telemetry · Strict CSP (connect-src 'none')

1. Paste OpenAPI Spec (Quick-Lint) & Controls

OAS 2.0 / 3.0 / 3.1 · OWASP API Top 10
Parsed JSON OpenAPI 3.0.1 · 2 ops · 1 {id} routes · 1 nullable: true · ~522 tok
OWASP API Top 10 & MCP Readiness Checklist (100 Points)
Moderate Schema / Auth Gaps
75 / 100 (C)
CONDITIONAL — FIX GAPS IN PR

Passing: 6 · Fixes Needed: 2 · Target: OpenAPI 3.1.0

Est. MCP Schema Tokens
2,184 tok
$9.83/mo at 50 turns/day ($3/1M)
Reclaimable Diet Savings
-574 tok
Saves $2.58/mo via MCPDiet
API2-AUTH (OWASP API2:2023): Explicit components.securitySchemes (Bearer JWT / OAuth2 scopes) + global/op security PASS
Bearer JWT / OAuth2 securitySchemes and security[] requirements are enforced.
API1-BOLA (OWASP API1:2023): Object-ID routes ({id}) enforce explicit 401/403 responses & tenant ownership scopes CRITICAL FIX
Object-ID routes ({id}) lack explicit 401/403 security contracts and ownership scope checks (OWASP API1 BOLA — #1 API breach vector).
API3-BOPLA (OWASP API3:2023): additionalProperties: false + readOnly: true on server-owned fields (role, id, plan) PASS
Request schemas lock additionalProperties: false and protect server fields with readOnly: true.
API4-BOUNDS (OWASP API4:2023): maxLength, maxItems, maximum & bounded pagination (limit <= 100 / cursor) on inputs PASS
Strings, arrays, and pagination limits define strict maxLength, maxItems, and maximum bounds.
API8-TLS (OWASP API8:2023): HTTPS-only servers[] URLs (zero http:// prod) + strict CORS allowlist & headers PASS
Production servers[] enforce HTTPS-only URLs and strict origin allowlist CORS.
API4-429 (OWASP API4 / API8): Explicit 401, 403 & 429 Too Many Requests responses with Retry-After / X-RateLimit-* HIGH FIX
Missing 429 rate-limit contracts and Retry-After headers leave brute-force and scraping throttles undocumented.
API9-INV (OWASP API9:2023): Versioned base paths + deprecated: true ops declare Sunset header & replacement path PASS
Deprecated endpoints publish Sunset headers and migration paths; zero shadow APIs.
MCP-TOKEN (AI / MCP Readiness): Concise tool descriptions (<= 120 tok/op) & OpenAPI 3.1 type arrays (no nullable: true) PASS
Operation descriptions stay lean (~61 tok/op) and OpenAPI 3.1.0 avoids nullable drift.
openapi-owasp-remediation.yaml
openapi: "3.1.0"
info:
  title: "Multi-Tenant SaaS Resource API"
  version: "1.0.0"
components:
  securitySchemes:
    bearerJwt:
      type: http
      scheme: bearer
      bearerFormat: JWT
    oauth2Auth:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://auth.example.com/authorize
          tokenUrl: https://auth.example.com/oauth/token
          scopes:
            items:read: Read tenant-scoped resources
            items:write: Mutate tenant-scoped resources
security:
  - bearerJwt: []
  responses:
    Unauthorized401:
      description: Missing or invalid Bearer JWT / OAuth2 token
    Forbidden403:
      description: Authenticated caller lacks tenant/object ownership scope
    TooManyRequests429:
      description: Rate limit exceeded
      headers:
        Retry-After:
          schema:
            type: integer
            minimum: 1
            maximum: 3600
        X-RateLimit-Remaining:
          schema:
            type: integer
            minimum: 0
Zero-Upload SpecDiff $49 Remediation PR

Audit Full OpenAPI Specs or Ship a Hardened PR Today

Run a 100% browser-side breaking-change diff, OWASP API Top 10 scan & SARIF 2.1.0 export on SpecDiff (https://spec.runglab.dev), order a $49 Done-For-You OpenAPI & MCP Remediation PR on Creem, or automate via POST /v1/openapi/audit (API Hub), remote MCP tool audit_openapi_spec, and Apify Cloud PPE.

OpenAPI Controls, Bounds & Verification Reference

Rule / Control Hardened Pattern Security & Token Rationale
Path Parameter Format format: uuid + maxLength: 36 Eliminates predictable sequential integers (/users/1042) & oversized injection strings
Explicit 401 vs 403 401 Unauthorized + 403 Forbidden Distinguishes missing JWT identity from cross-tenant object access denial
Tenant Ownership Claim x-tenant-scope / OAuth2 scopes Documents object ownership checks against authenticated JWT sub/org_id claims
Automated Spec Gate POST /v1/openapi/audit Flags every {id} route missing security or 401/403 response contracts

BOLA-Hardened OpenAPI 3.1 Object Route Contract

bola-hardened-route.yaml
paths:
  /v1/workspaces/{workspaceId}/invoices/{invoiceId}:
    get:
      operationId: getTenantInvoice
      description: Fetch a tenant-owned invoice by UUID.
      security:
        - oauth2Auth:
            - invoices:read
      parameters:
        - name: workspaceId
          in: path
          required: true
          schema:
            type: string
            format: uuid
            maxLength: 36
        - name: invoiceId
          in: path
          required: true
          schema:
            type: string
            format: uuid
            maxLength: 36
      responses:
        "200":
          description: Invoice owned by authenticated workspaceId
        "401":
          $ref: "#/components/responses/Unauthorized401"
        "403":
          $ref: "#/components/responses/Forbidden403"
        "404":
          description: Not found (use identical 403/404 policy to avoid enumeration)

Verify BOLA Rules via SpecDiff & DevTools MCP

audit-bola-ci.sh
# 1. Zero-upload browser audit (zero server upload):
#    https://spec.runglab.dev
# 2. RapidAPI / API Hub automated gate:
curl -sS -X POST https://hub.runglab.dev/v1/openapi/audit \
  -H "Content-Type: application/json" \
  -d '{"spec": "<OPENAPI_YAML_OR_JSON>"}'
# 3. Remote MCP tool in Cursor / Claude Code:
#    dev.runglab/devtools -> audit_openapi_spec

Key Engineering Takeaways

  • OWASP API1:2023 (BOLA) remains the #1 production API breach class because frameworks validate authentication globally while leaving per-record ownership unverified.
  • An OpenAPI specification cannot prove database SQL WHERE clauses on its own, yet flagging every {id} path that omits security[], 401/403 responses, or UUID bounds immediately catches shadow admin and unguarded object endpoints in PR review.
  • Avoid accepting user-supplied tenantId inside JSON request bodies when tenant context belongs exclusively inside the verified JWT claim or path scope.

Common Contract Pitfalls to Avoid

  • Returning 200 or 400 on unauthorized {id} probes without documenting 401 vs 403 contract tests for QA and DAST scanners.
  • Exposing sequential integer primary keys (/orders/1001) instead of random UUIDv4/ULID identifiers.
  • Overriding global `security:` with `security: []` on internal debug routes and forgetting to remove it before production.

More OpenAPI OWASP & MCP Optimization Guides

← Back to OpenAPI OWASP & MCP Scorer Hub · 2026 N=26 OpenAPI & MCP Benchmark → · MCP Context Token Cost Calculator → · CORS Preflight & Webhook HMAC Debugger → · SpecDiff Live Diff & SARIF → · $49 Remediation PR →

Frequently Asked Questions

Can an OpenAPI spec automatically prevent BOLA vulnerabilities?

OpenAPI linting catches missing auth schemes, missing 401/403 contracts, and unauthenticated {id} endpoints at PR time, and feeds contract-based DAST/integration tests that verify cross-tenant 403 enforcement.

Should BOLA denial return 403 Forbidden or 404 Not Found?

Either 403 (explicit policy denial) or 404 (avoiding ID existence oracle) is valid when consistent — ensure your OpenAPI spec documents both 401 and 403/404 and automated tests assert cross-tenant rejection.

How can I audit my full OpenAPI spec for OWASP API1 right now?

Paste it into the workbench above, drop it into zero-upload https://spec.runglab.dev, or order a $49 Done-For-You OpenAPI & MCP Remediation PR.