Undefined string limit

owasp:api4:2019-string-limit

Rule Severity:

High

Ensure Query String properties or parameters have an explicitly defined maximum length. This can be done using maxLength, enum or const.
This rule applies at the API Specification level (OAS/Swagger).
Endpoints that accept query string properties or parameters with an unlimited length are at risk of service interruption.

1. How to Identify with Example Scenario

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

schemas:
 Myobj:
   type: string

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

schemas:
   Myobj:
     type: string
     maxLength: 99

2. How to Resolve with Example Scenario

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