# OpenAPI OWASP API Top 10 & MCP Readiness PR Checklist — OpenAPI 3.0 - 3.1 Migration API
- **Score:** 90/100 (Grade A) — **HARDENED — OWASP & MCP READY**
- **Target Standard:** OpenAPI 3.1.0
- **Endpoints Modeled:** 15 ops (~2,070 MCP pre-prompt tokens/turn · $9.32/mo at 50 turns/day on $3/1M)
- **Reclaimable MCP Schema Diet:** 345 tokens/turn ($1.55/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.
- [x] **API9-INV (OWASP API9:2023)** — Versioned base paths + deprecated: true ops declare Sunset header & replacement path
- 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)
- Verbose descriptions (~43 tok/op) and legacy nullable: true add ~345 wasted MCP pre-prompt tokens.
## 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.
# Scan spec for OpenAPI 3.0 keywords removed/changed in 3.1:
grep -nE "nullable:|exclusiveMinimum:s*(true|false)|exclusiveMaximum:s*(true|false)|format:s*(binary|byte)" openapi.yaml
# Diff 3.0 vs 3.1 output schemas for breaking SDK changes:
# https://spec.runglab.dev
Key Engineering Takeaways
OpenAPI 3.1.0 aligns 100% with JSON Schema Draft 2020-12 — meaning `nullable: true` is invalid/ignored and must become `type: ["string", "null"]` (and `null` must be included in `enum` if an enum allows null!).
Forgetting to include `null` inside `enum: [...]` when switching to `type: ["string", "null"]` causes JSON Schema validators and MCP tool clients to reject `null` values at runtime.
Numeric `exclusiveMinimum: true` in 3.0 becomes numeric `exclusiveMinimum: 0` in 3.1 — a common silent failure during automated version bumps.
Common Contract Pitfalls to Avoid
Changing only `openapi: "3.0.3"` -> `openapi: "3.1.0"` without rewriting `nullable: true` and `exclusiveMinimum: true`.
Writing `null` unquoted in YAML (`- null` vs `- "null"`) inconsistently across YAML parsers (YAML 1.2 treats bare `null` as null literal rather than the string "null" needed inside `type:`).
Neglecting to test generated TypeScript (`openapi-typescript`), Python Pydantic, and MCP clients after converting nullable fields.
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.
Should `null` inside OpenAPI 3.1 `type:` arrays be quoted as `"null"` in YAML?
Yes! In JSON Schema `type` expects string type names (`"string"`, `"null"`). In YAML, unquoted `null` parses as YAML null rather than the string `"null"` — always write `type: [string, "null"]`.
What happens if I have an `enum` with `type: ["string", "null"]`?
Under JSON Schema 2020-12, `enum` validates exact values regardless of `type` — so if `null` is permitted, include `null` (unquoted YAML null) inside the `enum` list too.
Can SpecDiff compare my 3.0 spec against the migrated 3.1 spec?
Yes — drop both files into https://spec.runglab.dev (100% local in browser) to verify zero accidental contract regressions.