At least one 200 or 202 response should be defined for HEAD operations

Description

HEAD operations in your API must have at least one 200 or 202 response defined.

For more details, see RFC 7231.

Example

The following is an example of how this type of risk could look in your API definition:

"head": {
  ...
  "responses": {
    "404": {
        "description": "Not found"
        "content": {
            "application/json": {
                "schema": {
                    "$ref": "#/definitions/404"
                }
            }
        }           
    }
  }
}

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 200 or 202 responses for all HEAD operations.

"head": {
  ...
  "responses": {
    "200": {
      "description": "OK"
    }
    "404": {
        "description": "Not found"
        "content": {
            "application/json": {
                "schema": {
                    "$ref": "#/definitions/404"
                }
            }
        }           
    }
  }
}