At least one 200, 201, 202, or 204 response should be defined for PATCH operations

Description

PATCH operations in your API must have at least one 200, 201202, or 204 response defined.

For more details, see RFC 7231.

Example

The following is an example of how this issue could look like in your API definition:

"patch": {
    ...
    "responses": {
      "default": {
        "description": "Unexpected error",
        "schema": {
          "$ref": "#/components/schemas/Error"
        }
      }
    }
  }
}

Reusable components are referenced from #/definitions/ (OAS v2) or  #/components/ (OAS v3) sections.

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, 201202, or 204 responses for all PATCH operations.

"patch": {
    ...
    "responses": {
      "204": {
        "description": "Updated"
      }
      "default": {
        "description": "Unexpected error",
        "schema": {
          "$ref": "#/components/schemas/Error"
        }
      }
    }
  }
}

Get API Security news directly in your Inbox.

By clicking Subscribe you agree to our Data Policy