Cluster 9 · OWASP API9:2023 · Shadow APIs · Sunset

Auditing Shadow Endpoints, Sunset Headers & Deprecated Operations in OpenAPI

Prevent OWASP API9:2023 Improper Inventory Management by eliminating undocumented shadow endpoints, tracking explicit API versions, and pairing deprecated: true operations with RFC 8594 Sunset headers.

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)
Low API Exploit & Token Risk
90 / 100 (A)
HARDENED — OWASP & MCP READY

Passing: 7 · Fixes Needed: 1 · Target: OpenAPI 3.1.0

Est. MCP Schema Tokens
2,736 tok
$12.31/mo at 50 turns/day ($3/1M)
Reclaimable Diet Savings
-666 tok
Saves $3.00/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 PASS
Parameterized {id} endpoints verify tenant ownership and document 401/403 status codes.
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-* PASS
401, 403, and 429 Too Many Requests responses include Retry-After / X-RateLimit-* headers.
API9-INV (OWASP API9:2023): Versioned base paths + deprecated: true ops declare Sunset header & replacement path HIGH FIX
Missing API versioning, shadow routes, or deprecated operations without Sunset headers (OWASP API9 Improper Inventory).
MCP-TOKEN (AI / MCP Readiness): Concise tool descriptions (<= 120 tok/op) & OpenAPI 3.1 type arrays (no nullable: true) PASS
Operation descriptions stay lean (~57 tok/op) and OpenAPI 3.1.0 avoids nullable drift.
openapi-owasp-remediation.yaml
openapi: "3.1.0"
info:
  title: "Versioned Legacy + v2 API"
  version: "1.0.0"
components:
  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
paths:
  /v1/workspaces/{workspaceId}/members:
    get:
      operationId: listWorkspaceMembers
      description: List members for a tenant workspace.
      parameters:
        - name: workspaceId
          in: path
          required: true
          schema:
            type: string
            format: uuid
            maxLength: 36
        - name: limit
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 25
      responses:
        "200":
          description: Bounded member page
        "401":
          $ref: "#/components/responses/Unauthorized401"
        "403":
          $ref: "#/components/responses/Forbidden403"
        "429":
          $ref: "#/components/responses/TooManyRequests429"
  /v0/members:
    get:
      deprecated: true
      description: Deprecated; migrate to /v1/workspaces/{workspaceId}/members.
      responses:
        "200":
          description: Legacy response
          headers:
            Sunset:
              schema:
                type: string
                format: date-time
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
Explicit API Versioning /v1/, /v2/ or dated header Eliminates unversioned shadow routes coexisting with hardened v2 endpoints
deprecated: true + Sunset RFC 8594 Sunset + Deprecation Notifies SDKs and consumers of exact retirement dates in response headers
x-internal / Exclusion Strip internal/admin ops from public spec Keep private debug and backoffice endpoints out of public partner contracts
Diff-Based Inventory Gate SpecDiff CI diff on every PR Catches undocumented endpoint additions and accidental breaking removals

RFC 8594 Deprecation & Sunset Header Contract in OpenAPI 3.1

api9-sunset-inventory.yaml
paths:
  /v1/legacy/invoices:
    get:
      operationId: listLegacyInvoices
      deprecated: true
      description: Deprecated in v1.8; migrate to GET /v2/tenants/{tenantId}/invoices before 2027-03-01.
      responses:
        "200":
          description: Legacy invoice page (scheduled for retirement)
          headers:
            Deprecation:
              schema:
                type: string
              example: "@1795705200"
            Sunset:
              description: RFC 8594 HTTP-date after which this endpoint returns 410 Gone
              schema:
                type: string
              example: "Mon, 01 Mar 2027 00:00:00 GMT"
            Link:
              schema:
                type: string
              example: '<https://docs.example.com/migrations/v2-invoices>; rel="deprecation"'

Inventory Diff & Shadow Endpoint Detection with SpecDiff

ci-inventory-diff.sh
# Compare main vs PR OpenAPI specs to spot newly exposed shadow routes or unannounced removals:
curl -sS -X POST https://hub.runglab.dev/v1/openapi/diff \
  -H "Content-Type: application/json" \
  -d '{"oldSpec": "...", "newSpec": "..."}'

# Or drag-and-drop base & head specs locally at https://spec.runglab.dev

Key Engineering Takeaways

  • OWASP API9:2023 happens when teams ship `/v2/` with OAuth2 and rate limiting while leaving unmonitored `/v1/` or `/beta/` endpoints live in production.
  • Marking an OpenAPI operation `deprecated: true` is invisible at runtime unless paired with RFC 8594 `Sunset` and `Deprecation` headers so client telemetry flags callers before shutdown.
  • Running automated spec diffs in CI catches unreviewed route additions before shadow endpoints reach production.

Common Contract Pitfalls to Avoid

  • Keeping `/v0/` or `/internal/debug` endpoints deployed in production router files without documenting or retiring them.
  • Using `deprecated: true` with no retirement date, leaving legacy code paths alive indefinitely.
  • Publishing one monolithic OpenAPI file containing both customer-facing routes and internal admin endpoints.

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

What is the difference between Deprecation and Sunset HTTP headers?

`Deprecation` signals that an endpoint is already deprecated (and optionally when it became deprecated), while `Sunset` (RFC 8594) gives the future date/time when the endpoint is expected to stop working.

How do I prevent shadow APIs from slipping past OpenAPI specs?

Generate or validate your OpenAPI spec directly in CI from typed router definitions and gate PRs with SpecDiff (/v1/openapi/diff or GitHub Actions SARIF).

Does retiring a deprecated endpoint require a Major SemVer bump?

Removing any previously documented endpoint or status contract is a breaking change for callers still depending on it — check exact SemVer bump guidance at https://spec.runglab.dev.