Missing array limit

owasp:api4:2019-array-limit

Rule Severity:

High

Endpoints ingesting arrays should specify a limit to the number of objects in the array to ensure availability of the service to all users.
This rule applies at the API Specification level (OAS/Swagger).
Using OpenAPI Spec to limit the number of items an endpoint can receive in an array is a form of rate limiting. Using the 'maxItems' keyword in array schemes will help prevent denial of service (DoS) attacks.

1. How to Identify with Example Scenario

Find the text in bold to identify issues such as these in API specifications

type: arrayitems: type: integer # arbitrary item type minItems: 1 # missing 'maxItems' keyword definition

2. How to Identify with Example Scenario

Find the text in bold to identify issues such as these in API specifications

1. How to Resolve with Example Scenario

Find the text in bold to identify issues such as these in API specifications

type: arrayitems: type: integer # arbitrary item type minItems: 1 # arbitrary minimum number of items maxItems: 10 # arbitrary maximum number of items

2. How to Resolve with Example Scenario

Modify the text in bold to resolve issues such as these in API specifications