406 response should be defined for all GET, POST, PUT, PATCH, and DELETE operations
One or more operations in your API are missing
406 responses. Operations should have
default response defined if they do both of the following:
- The operation defines a response that is not a
- The operation constrains the MIME type of the response.
For more details, see RFC 7231.
The following is an example of how this type of risk could look in your API definition:
1responses: 2 "200": 3 description: pet response 4 content: 5 application/json: 6 schema: 7 $ref: "#/components/schemas/Pet" 8
Possible exploit scenario
Attackers strive to make your APIs behave in an unexpected way to learn more about your system or to cause a data breach. We highly recommend that you minimize any risks and clearly specify the data that your API operations can return for each possible response code.
Make sure that all operations that define a response that is not
204 and that constrain the MIME type of the response have the
406 response defined too.
1responses: 2 "200": 3 description: pet response 4 content: 5 application/json: 6 schema: 7 $ref: "#/components/schemas/Pet" 8 # ... 9 "406": 10 description: Not Acceptable 11 content: 12 application/json: 13 schema: 14 $ref: "#/components/responses/406" 15
Copyright 42Crunch 2021