Response that should contain a body has no schema defined
You have not defined any schemas for responses that should contain a body.
Empty or no schemas for responses are only acceptable for responses that do not have any content:
- The operation in question is
HEAD(no content allowed for
HEADresponses), see RFC 7231.
- The returned HTTP status code is
304(no content allowed for these codes), see RFC 7231 and RFC 7232.
The following is an example of how this type of risk could look in your API definition:
1get: 2 description: Returns all pets from the system that the user has access to 3 # ... 4 responses: 5 "200": 6 description: OK 7
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.
Define schemas for all responses that should have a body.
1get: 2 description: Returns all pets from the system that the user has access to 3 # ... 4 responses: 5 "200": 6 description: pet response 7 schema: 8 type: array 9 items: 10 $ref: "#/definitions/Pet" 11
Alternatively, if you do not want to include a body, you can change the HTTP status code in the response to one that should not have a body.
Copyright 42Crunch 2021