Missing retry header

owasp:api4:2019-rate-limit-retry-after

Rule Severity:

High

Ensure that APIs returning 429 responses contain a Retry-After header.
This rule applies at the API Specification level (OAS/Swagger).
Endpoints should use proper rate limiting to ensure service availability to all users. The Retry-After header indicates how long a user of an API will need to wait before making a new request.

1. How to Identify with Example Scenario

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

responses: '429': description: Rate limit exceeded # Missing Retry-After header

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

responses: '429': description: Rate limit exceeded headers: Retry-After: description: Indicates how long the client should wait before making a follow-up request. schema: type: string # example: 'Mon, 7 Aug 2023 07:28:00 GMT' # optionally add examples for both date and delay-seconds examples: http-date: value: 'Mon, 7 Aug 2023 07:28:00 GMT' delay-seconds: value: '120'

2. How to Resolve with Example Scenario

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