Response that should contain a body has no schema defined
Issue ID: response-schema-undefined
Average severity: Medium
Description
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:
Example
The following is an example of how this type of risk could look in your API definition:
{
"get": {
"description": "Returns all pets from the system that the user has access to",
// ...
"responses": {
"200": {
"description": "OK"
}
}
}
}
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.
Remediation
Define schemas for all responses that should have a body.
{
"get": {
"description": "Returns all pets from the system that the user has access to",
// ...
"responses": {
"200": {
"description": "pet response",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Pet"
}
}
}
}
}
}
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.