Undefined integer limit

owasp:api4:2019-integer-limit

Rule Severity:

High

Ensure that endpoints using integers specify limits for them. Use 'minimum' and 'maximum' or 'exclusiveMinimum' and 'exclusiveMaximum' to set the allowed range.
This rule applies at the API Specification level (OAS/Swagger).
Explicitly expecting integers within a specified range in the API spec will help mitigate resource exhaustion attacks (a sub-type of denial of service). APIs may suffer performance and availability issues when faced with an integer format they were not designed to process.

1. How to Identify with Example Scenario

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

type: objectproperties: myObj: # arbitrary name for the object type: integer # missing "minimum" & "maximum"

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: objectproperties: myObj: # arbitrary name for the object type: integer maximum: 99 minimum: 1

2. How to Resolve with Example Scenario

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

type: objectproperties: myObj: # arbitrary name for the object type: integer exclusiveMaximum: 99 exclusiveMinimum: 1

References: