# OpenAPI OWASP API Top 10 & MCP Readiness PR Checklist — Versioned Legacy + v2 API
- **Score:** 90/100 (Grade A) — **HARDENED — OWASP & MCP READY**
- **Target Standard:** OpenAPI 3.1.0
- **Endpoints Modeled:** 18 ops (~2,736 MCP pre-prompt tokens/turn · $12.31/mo at 50 turns/day on $3/1M)
- **Reclaimable MCP Schema Diet:** 666 tokens/turn ($3.00/mo saved)
## Security & Schema Review Checklist
- [x] **API2-AUTH (OWASP API2:2023)** — Explicit components.securitySchemes (Bearer JWT / OAuth2 scopes) + global/op security
- Bearer JWT / OAuth2 securitySchemes and security[] requirements are enforced.
- [x] **API1-BOLA (OWASP API1:2023)** — Object-ID routes ({id}) enforce explicit 401/403 responses & tenant ownership scopes
- Parameterized {id} endpoints verify tenant ownership and document 401/403 status codes.
- [x] **API3-BOPLA (OWASP API3:2023)** — additionalProperties: false + readOnly: true on server-owned fields (role, id, plan)
- Request schemas lock additionalProperties: false and protect server fields with readOnly: true.
- [x] **API4-BOUNDS (OWASP API4:2023)** — maxLength, maxItems, maximum & bounded pagination (limit <= 100 / cursor) on inputs
- Strings, arrays, and pagination limits define strict maxLength, maxItems, and maximum bounds.
- [x] **API8-TLS (OWASP API8:2023)** — HTTPS-only servers[] URLs (zero http:// prod) + strict CORS allowlist & headers
- Production servers[] enforce HTTPS-only URLs and strict origin allowlist CORS.
- [x] **API4-429 (OWASP API4 / API8)** — Explicit 401, 403 & 429 Too Many Requests responses with Retry-After / X-RateLimit-*
- 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
- Missing API versioning, shadow routes, or deprecated operations without Sunset headers (OWASP API9 Improper Inventory).
- [x] **MCP-TOKEN (AI / MCP Readiness)** — Concise tool descriptions (<= 120 tok/op) & OpenAPI 3.1 type arrays (no nullable: true)
- Operation descriptions stay lean (~57 tok/op) and OpenAPI 3.1.0 avoids nullable drift.
## Automated Verification & Done-For-You Remediation
- Free Zero-Upload OpenAPI Diff & OWASP Audit: https://spec.runglab.dev
- $49 Done-For-You OpenAPI & MCP Remediation PR (Creem): https://www.creem.io/product/prod_4KoVJW4YEAf6XjjuSK44lp
- RapidAPI Live Endpoint (`POST /v1/openapi/audit`): https://hub.runglab.dev
- Remote MCP Tool (`audit_openapi_spec`): https://mcp-server.runglab.dev/
- Apify Cloud PPE Actor: https://apify.com/runglab/openapi-spec-diff-auditor
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.
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.
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.
Close OWASP API3:2023 Broken Object Property Level Authorization (BOPLA) and Mass Assignment gaps by enforcing additionalProperties: false, readOnly server attributes, and strict request DTOs.
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.