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.
# Find string/array schemas missing maxLength or maxItems in openapi.json:
jq '[.. | objects | select(.type == "string" and (.maxLength == null) and (.enum == null) and (.format != "uuid"))] | length' openapi.json
jq '[.. | objects | select(.type == "array" and (.maxItems == null))] | length' openapi.json
# Or audit + patch all API4 rules automatically on https://spec.runglab.dev
Key Engineering Takeaways
Every unbounded `type: string` or `type: array` in an OpenAPI schema is an open invitation for multi-megabyte JSON bombs, ReDoS stalls, or batch-loop database exhaustion.
API gateways (Cloudflare, Envoy, Kong, AWS API Gateway) and OpenAPI request validators can enforce `maxLength`, `maxItems`, and `maximum` at the edge before your app server parses a byte.
In AI/MCP workflows, bounded `maxItems` and `maximum` also prevent hallucinated LLM tool arguments (`limit: 100000`) from crashing backend pagination.
Common Contract Pitfalls to Avoid
Setting `type: integer` on `page` / `limit` query parameters without `minimum: 1` and `maximum: 100`.
Applying complex nested `pattern:` regexes to strings that have no `maxLength` cap.
Returning unbounded nested arrays in `200 OK` list endpoints without cursor pagination.
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 maxItems and maximum values should standard SaaS APIs use?
Most B2B APIs cap `limit` at `maximum: 100` (default `25`), array batch inputs at `maxItems: 20..100`, short identifiers/emails at `maxLength: 36..254`, and freeform notes at `maxLength: 1000..4000`.
Does adding maxLength / maxItems break existing clients?
Adding bounds to an already-live endpoint is a potential breaking change if legitimate callers exceed the cap — use SpecDiff (https://spec.runglab.dev) to check SemVer impact before tightening limits.
How does API4 relate to HTTP 429 rate-limit responses?
OWASP API4 covers both payload/compute bounds (maxLength, maxItems, pagination) and request-rate throttling (429 Too Many Requests with Retry-After headers).