QID 570072
QID 570072: Rate Limits Not Defined
Rate limiting is required to be defined to avoid attackers overloading an API operation. HTTP headers are used to define rate limits. Specific response codes related to 2XX and 4XX should have rate limits defined. An analysis of swagger file has resulted in detecting rate limit missing for response codes related to 2XX and 4XX responses.
Following header are applied by default:
X-RateLimit-Limit
X-Rate-Limit-Limit
RateLimit-Limit
RateLimit-Reset
Swagger file is not compliant and will result in an error. Absence of proper rate limiting to the specific response code will give an opportunity to overload the API. Absence of the retry limit will not protect the resource consumption over use by API consumers and attackers.
Solution
Implement rate-limiting using HTTP headers. IETF Draft HTTP RateLimit Headers:. https://datatracker.ietf.org/doc/draft-ietf-httpapi-ratelimit-headers/
For example:
responses: '200': headers: RateLimit-Limit: description: The number of allowed requests in the current period. schema: type: integer RateLimit-Reset: description: The number of seconds left in the current period. schema: type: integer
responses: '200': headers: RateLimit-Limit: description: The number of allowed requests in the current period. schema: type: integer RateLimit-Reset: description: The number of seconds left in the current period. schema: type: integer
Vendor References
CVEs related to QID 570072
Software Advisories
| Advisory ID | Software | Component | Link |
|---|